Long story short, I need to change IPs of 150 VMs. I've been able to get the Set-VMGuestnetworkinterface to work for the most part, but I have 2 questions.
First the code!
$myVM1 = Get-VM -Name "mockup AD"
$interface = Get-VMGuestNetworkInterface -VM $myVM1 -GuestUser administrator -GuestPassword password
$guest = Get-VMGuest $myVM1
$interface = Get-VMGuestNetworkInterface -VMGuest $guest -GuestUser administrator -GuestPassword password
Set-VMGuestNetworkInterface -VMGuestNetworkInterface $interface -GuestUser administrator -GuestPassword password -IPPolicy static -IP 192.168.0.250 -Gateway 192.168.0.1 -Dns ("192.168.0.250", "192.168.0.2")
Question 1: I can only successfully run these commands passing the client's local administrator account. If I don't it comes back with:
I've attempted to run these commands using a domain admin account formatted as "test\ttest" but have also attempted "test.lab.local\ttest" as well as the domain account placed right into the administrators group on the test server with no luck. I'm pretty sure this is due to the UAC and I'd prefer not disabling UAC on all our servers. Any ideas getting around this?
2) When the commands are issued, and it succeeds to change everything that I've specified but generates the following errors:
Set-VMGuestNetworkInterface : 4/5/2013 12:41:37 PM Set-VMGuestNetworkInterfa
ce "Error occured while configuring the network:'Element not found.
'.
At line:1 char:28
+ Set-VMGuestNetworkInterface <<<< -VMGuestNetworkInterface $interface -GuestU
ser administrator -GuestPassword password -IPPolicy static -IP 192.168.0.250 -G
ateway 192.168.0.1 -Dns ("192.168.0.250", "192.168.0.2")
+ CategoryInfo : InvalidArgument: (:) [Set-VMGuestNetworkInterfac
e], ViError
+ FullyQualifiedErrorId : Client20_VmGuestService_SetVmGuestNetworkInterfa
ce_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVmGuestNetworkInt
erface
Set-VMGuestNetworkInterface : 4/5/2013 12:41:56 PM Set-VMGuestNetworkInterfa
ce "Error occured while configuring the network:'Element not found.
'.
At line:1 char:28
+ Set-VMGuestNetworkInterface <<<< -VMGuestNetworkInterface $interface -GuestU
ser administrator -GuestPassword password -IPPolicy static -IP 192.168.0.250 -G
ateway 192.168.0.1 -Dns ("192.168.0.250", "192.168.0.2")
+ CategoryInfo : InvalidArgument: (:) [Set-VMGuestNetworkInterfac
e], ViError
+ FullyQualifiedErrorId : Client20_VmGuestService_SetVmGuestNetworkInterfa
ce_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVmGuestNetworkInt
erface
I know it's successful, but I'd prefer elminate these errors.
Thanks for the look!