Difference between revisions of "Vsphere Powercli"
Jump to navigation
Jump to search
(Created page with "re-register ips with dhcp ``` $Datacenter = "" $vCenter = "" Connect-VIServer $vCenter $vmlist = Get-Cluster "" | Get-VM # | Select @{N="IP Address";E={@($_.guest.IPAddress[0...") |
|||
Line 14: | Line 14: | ||
$script0 = "Register-DNSClient" | $script0 = "Register-DNSClient" | ||
Invoke-VMScript $script0 -vm $vmName -GuestCredential $GetCred | Invoke-VMScript $script0 -vm $vmName -GuestCredential $GetCred | ||
− | #Invoke-Command -ComputerName $vm -Credential $GetCred -ScriptBlock { Register-DnsClient } | + | # Invoke-Command -ComputerName $vm -Credential $GetCred -ScriptBlock { Register-DnsClient } |
− | #sleep 10 | + | # sleep 10 |
} | } | ||
``` | ``` |
Revision as of 15:16, 11 June 2021
re-register ips with dhcp
$Datacenter = "" $vCenter = "" Connect-VIServer $vCenter $vmlist = Get-Cluster "" | Get-VM # | Select @{N="IP Address";E={@($_.guest.IPAddress[0])}} $sleep = sleep 10 $GetCred = Get-Credential foreach ($vm in $vmlist) { $vmName = Get-VM $vm $script0 = "Register-DNSClient" Invoke-VMScript $script0 -vm $vmName -GuestCredential $GetCred # Invoke-Command -ComputerName $vm -Credential $GetCred -ScriptBlock { Register-DnsClient } # sleep 10 }