PowerShell for Windows Admins

Oct 6 2010   2:53PM GMT

WMI and Network Adapters: 9

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

We have seen how to test if a NIC is DHCP enabled but what about manipulating the DHCP settings.  First off lets look at renewing a DHCP lease.

We can see the lease information

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "Index=’11’"  | select *dhcp*

The important properties are:

DHCPEnabled       : True
DHCPLeaseExpires  : 20101007180829.000000+060
DHCPLeaseObtained : 20101006180829.000000+060

The system can be told to get a new lease by using the RenewDHCPLease method

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "Index=’11’"  |

Invoke-WmiMethod -Name RenewDHCPLease

We can then test the lease again

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "Index=’11’"  | select *dhcp*

DHCPEnabled       : True
DHCPLeaseExpires  : 20101007214733.000000+060
DHCPLeaseObtained : 20101006214733.000000+060

Job done

 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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: