Im trying to put together a script to enable me to change VM IPs following a vSphere Replication failover however i am having an issue getting it to run.... so far i have the following?
$localCreds = Get-Credential
$FailoverNetworkIP = "10.*.*.*"
$FailoverNetworkSubNet = "255.255.255.0"
$FailoverNetworkGW = "10.*.*.*"
$netsh = "c:\windows\system32\netsh.exe interface ip set address ""VLAN ***"" static $FailoverNetworkIP $FailoverNetworkSubNet $FailoverNetworkGW 1"
Invoke-VMScript –VM “S*******(CLONE)” -GuestCredential $localCreds -ScriptType bat -ScriptText $netsh
I am getting the below error:
WARNING: The version of VMware Tools on VM 'S*******(CLONE)' is out of date and may cause Invoke-VMScript to work improperly.
Invoke-VMScript : 24/02/2020 09:35:47 Invoke-VMScript A specified parameter was not correct:
At line:1 char:1
+ Invoke-VMScript –VM “S*******(CLONE)” -GuestCredential $localCreds -S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-VMScript], InvalidArgument
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
Can anyone shed some light onto where i am going wrong?
If the copy of your code in here is correct, the quotes surrounding the VM's display name are UTF-8 double quotation marks (hex codes E2 80 93 and E2 80 9D).
Try replacing those with ANSI double quotes (hex code 22).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Changed it but still getting an error:
PS H:\> Invoke-VMScript –VM "S********(CLONE)" -GuestCredential $localCreds -ScriptType bat -ScriptText $netsh
WARNING: The version of VMware Tools on VM 'S********(CLONE)' is out of date and may cause Invoke-VMScript to work improperly.
Invoke-VMScript : 24/02/2020 10:44:55 Invoke-VMScript A general system error occurred: vix error codes = (1, 0).
At line:1 char:1
+ Invoke-VMScript –VM "********(CLONE)" -GuestCredential $localCreds -S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Invoke-VMScript], SystemError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
Im not really seeing much in vmware.log of the VM either:
2020-02-24T10:35:46.528Z| vcpu-2| I125: GuestRpc: Reinitializing Channel 1(toolbox-dnd)
2020-02-24T10:35:52.886Z| vcpu-3| W115: GuestRpc: application toolbox-dnd, changing channel 65535 -> 1
2020-02-24T10:35:52.886Z| vcpu-3| I125: GuestRpc: Channel 1, guest application toolbox-dnd.
2020-02-24T10:38:53.358Z| vmx| I125: VigorTransportProcessClientPayload: opID=5bc915d-e2-59b9 seq=6902: Receiving GuestOps.CreateTemporaryFile request.
2020-02-24T10:38:53.409Z| vcpu-0| I125: VigorTransport_ServerSendResponse opID=5bc915d-e2-59b9 seq=6902: Completed GuestOps request.
2020-02-24T10:39:56.275Z| vmx| I125: VigorTransportProcessClientPayload: opID=4e66e0c-49-5b1e seq=6976: Receiving GuestOps.CreateTemporaryFile request.
2020-02-24T10:39:56.284Z| vcpu-1| I125: VigorTransport_ServerSendResponse opID=4e66e0c-49-5b1e seq=6976: Completed GuestOps request.
2020-02-24T10:44:54.594Z| vmx| I125: VigorTransportProcessClientPayload: opID=37e6ecc1-f7-61df seq=7293: Receiving GuestOps.CreateTemporaryFile request.
2020-02-24T10:44:54.623Z| vcpu-0| I125: VigorTransport_ServerSendResponse opID=37e6ecc1-f7-61df seq=7293: Completed GuestOps request.
EDIT
looks like the change of error was due to incorrect credentials, ive updated and im back to the original error
Do you actually have those asterisks in the VM's Displayname, or you just masking te real name in this public forum?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Just masking server names.
Im wondering if this is a UAC issue as when i run netsh locally to change the IP, it requires elevation...
That wouldn't produce those errors.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
A suggestion, run the same with my Invoke-VMSCriptPlus and the Verbose option.
It tends to provide more information when something goes wrong
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference