PowerShell for Windows Admins

Sep 20 2014   10:13AM GMT

Creating a DHCP reservation

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
DHCP Reservation
Powershell

For my demo at the PowerShell Summit I wanted to use DHCP for the Linux machine but guarantee that it had a specific IP address. Time to create a DHCP reservation

The DHCP module in Windows Server 2012 and 2012 R2 enables you to create a reservation:

Add-DhcpServerv4Reservation -ScopeId 10.10.54.0 -IPAddress 10.10.54.2 -ClientId 00155D36C906 -Description “Linux machine” -Name “SphinxLX01”

The clientid is the VMs MAC address.

You can view the current reservations:

£> Get-DhcpServerv4Reservation -ScopeId 10.10.54.0 | fl *
IPAddress             : 10.10.54.2
ScopeId               : 10.10.54.0
AddressState          : ActiveReservation
ClientId              : 00-15-5d-36-c9-06
Description           : LInux machine
Name                  : SphinxLX01
Type                  : Both

You can view current leases:

£> Get-DhcpServerv4Lease -ScopeId 10.10.54.0 | fl *
IPAddress             : 10.10.54.2
ScopeId               : 10.10.54.0
AddressState          : ActiveReservation
ClientId              : 00-15-5d-36-c9-06
ClientType            : Dhcp
Description           : LInux machine
DnsRegistration       : NotApplicable
DnsRR                 : NoRegistration
HostName              : SphinxLX01
LeaseExpiryTime       :
NapCapable            : False
NapStatus             : FullAccess
PolicyName            :
ProbationEnds         :
ServerIP              : 10.10.54.201

And all from the comfort of your very own PowerShell prompt.

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: