header image

Creating a DHCP server

Posted by: | April 2, 2011 | No Comment |

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!

under: PowerShellV2, Windows Server 2008 R2