How to add DHCP role to server manager using a vhd through powershell RRS feed

  • Question

  • How can I add a DHCP role using a vhd through Powershell? 

    Server name- JTest23

    VHD name-DHCP Role.vhd

    • Edited by MB23red Friday, May 11, 2018 2:41 AM
    • Moved by jrv Friday, May 11, 2018 3:08 AM Better forum
    Friday, May 11, 2018 2:37 AM

All replies

  • You cannot add a role by specifying a VHD,


    Friday, May 11, 2018 3:07 AM
  • Hi,

    Yes you can. You install a feature/role to a VHD with the -Switch VHD (even if it is a .vhdx you are pointing at...)

    This is the example from my test VM. If you want to install roles and features on the VHD you need to power off the VM.

    Add-WindowsFeature -Vhd "C:\Users\Administrator\Desktop\VM01\VM01\Virtual Hard Disks\VM01.vhdx" -Name DHCP -IncludeAllSubFeature -IncludeManagementTools


    If you found this post helpful, please give it a "Helpful" vote. 
    Please remember to mark the replies as answers if they help.

    • Proposed as answer by jrv Monday, May 14, 2018 10:03 AM
    Friday, May 11, 2018 8:23 AM
  • That assumes the OP wants to install to a VHD with an OS already in the image and is not asking how to install DHCP from a VHD.

    You are probably correct and the question is just asked in an odd way.


    Friday, May 11, 2018 8:37 AM