{"id":578,"date":"2015-03-04T15:22:18","date_gmt":"2015-03-04T15:22:18","guid":{"rendered":"http:\/\/giraffeit.com\/?p=578"},"modified":"2015-03-04T15:22:18","modified_gmt":"2015-03-04T15:22:18","slug":"psdnslots","status":"publish","type":"post","link":"https:\/\/giraffeit.com\/index.php\/2015\/03\/04\/psdnslots\/","title":{"rendered":"Powershell : renew multiple machines DHCP scopes"},"content":{"rendered":"<p># grabs the ListofMachines from the CSV<br \/>\n$ListofMachines=Get-Content &#8220;c:tempmachines.csv&#8221;<br \/>\n# loop starts here<br \/>\nforeach ($machine in $ListofMachines)<br \/>\n{<br \/>\n#Performs a release ( if needed ! use with care remotely ! )<br \/>\n#Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $machine | Where { $_.IpEnabled -eq $true -and $_.DhcpEnabled -eq $true} | ForEach-Object -Process {$_.ReleaseDHCPLease()}<br \/>\n# query the $machine that has the DHCP enabled adapter and performs the renewal<br \/>\nGet-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $machine | Where { $_.IpEnabled -eq $true -and $_.DhcpEnabled -eq $true} | ForEach-Object -Process {$_.RenewDHCPLease()}<br \/>\nGet-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName 10.130.54.53 | Where { $_.IpEnabled -eq $true -and $_.DhcpEnabled -eq $true} | ForEach-Object -Process {ipconfig \/flushdns}<br \/>\n#log for Output!<br \/>\nwrite-output &#8220;$machine has had IP renewed &#8221; |out-file -filepath &#8220;c:tempresultsofDHCPLease04032015.csv&#8221; -append<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p># grabs the ListofMachines from the CSV $ListofMachines=Get-Content &#8220;c:tempmachines.csv&#8221; # loop starts here foreach ($machine in $ListofMachines) { #Performs a release ( if needed ! use with care remotely ! ) #Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $machine | Where { $_.IpEnabled -eq $true -and $_.DhcpEnabled -eq $true} | ForEach-Object -Process {$_.ReleaseDHCPLease()} # query the $machine that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/giraffeit.com\/index.php\/2015\/03\/04\/psdnslots\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Powershell : renew multiple machines DHCP scopes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-578","post","type-post","status-publish","format-standard","hentry","category-bog"],"_links":{"self":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts\/578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/comments?post=578"}],"version-history":[{"count":0,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/posts\/578\/revisions"}],"wp:attachment":[{"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/media?parent=578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/categories?post=578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/giraffeit.com\/index.php\/wp-json\/wp\/v2\/tags?post=578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}