Hi,
I am trying to update the DNS on all the VMs from the list. Now I am stuck, how to update the DNS IP with 192.168.15.100 and 192.168.15.101.
Please help.
Get-VM MyApp1 | Get-NetworkAdapter |
Select-Object @{N="VM";E={$_.Parent.Name}},
@{N="NIC";E={$_.Name}},
@{N="Network";E={$_.NetworkName}},
MacAddress,
@{N='IP';E={
$vNIc = $_
($_.Parent.ExtensionData.Guest.Net | where { $_.MacAddress -eq $vNIc.MacAddress }).IPAddress -join '|'
}},
@{N='DNS';E={($_.Parent.ExtensionData.Guest.Net.DNSConfig).IPAddress -join ', '}}
Current Output
VM | : MyApp1 |
NIC | : Network adapter 1 |
Network | : 12_dvs |
MacAddress : 00:50:56:97:79:da
IP | : 192.168.3.17 |
DNS | : 192.168.1.5, 192.168.1.6 |
I tested again with several combinations, and this works for me.
Is the user member of the Administrators group on the target machine?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD,
The user is a domain admin and its present in Administrators Group on the target machine.
The issue is on all Windows Servers 2012 R2 and 2016 Servers. But when I disable the UAC using the registry setting and reboot the server. the script changes the DNS IP.
I don't have any W2K12R2 servers but on my W2K16, where UAC is enabled, it works perfectly.
Not a lot more I can do I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks a lot for your help. I was able to get this script working by creating a local Administrator account. This helped me to change the DNS without disabling the UAC.
As always, you are simply superb. Thanks you very much