Difference between revisions of "Vsphere Powercli"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
$Datacenter = "" | $Datacenter = "" | ||
$vCenter = "" | $vCenter = "" | ||
− | |||
Connect-VIServer $vCenter | Connect-VIServer $vCenter | ||
$vmlist = Get-Cluster "" | Get-VM | $vmlist = Get-Cluster "" | Get-VM |
Latest revision as of 15:17, 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 }