Monthly Archive


Creating a DHCP server

I needed to add a DHCP server to my Windows 2008 R2 test environment .  I know I can use the ServerManager Module for this so I import the module and use get-command to refresh my memory on the cmdlets


PS> Import-Module servermanager
PS> get-command -Module servermanager

CommandType     Name                                      Definition
-----------     ----                                      ----------
Cmdlet          Add-WindowsFeature                        Add-WindowsFeature [-Name] <Feature[]> [-Include...
Cmdlet          Get-WindowsFeature                        Get-WindowsFeature [[-Name] <String[]>] [-LogPat...
Cmdlet          Remove-WindowsFeature                     Remove-WindowsFeature [-Name] <Feature[]> [-LogP...


Now we can discover the DHCP related features

PS> Get-WindowsFeature *dhcp*

Display Name                                            Name
------------                                            ----
[ ] DHCP Server                                         DHCP
        [ ] DHCP Server Tools                           RSAT-DHCP


I need the server and the tools –  one command does it

PS> Add-WindowsFeature -IncludeAllSubFeature -Name DHCP, RSAT-DHCP

Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True    No             Success   {DHCP Server, DHCP Server Tools}


It took longer to write this post than to do the work!

Leave a Reply