- This topic has 3 replies, 5 voices, and was last updated October 22, 2024 by Paul B.
Connect to Vcenter with powershell script from ZVM
The forum ‘Scripting and APIs’ is closed to new topics and replies.
Hello,
I would like some help regarding an issue I’m encountering when attempting to connect from a ZVM to a VCenter via a PowerShell script.
For context, I’m performing a failover using the prescript and postscript options provided by Zerto. I use these options to execute PowerShell scripts. Our Zerto version is Zerto version 9 update 4 patch 1 Build 090419021
The failover, from My_VCenter_A to My_VCenter_B, works, but the PowerShell postscript does not function correctly.
In my script, which is on my ZVM, one of the first actions is the Connect-VIServer command. This command returns the following error:
Connect-VIServer : 13/08/2024 16:07:25 Connect-VIServer Could not resolve the requested VC server.
Additional Information: There was no endpoint listening at XXX that could accept the message.
This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
At line:79 char:9
+ Connect-VIServer -Server XXXX -User XXXX …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (:) [Connect-VIServer], ViServerConnectionException
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_NameResolutionFailure,VMware.VimAutomation.ViCo
re.Cmdlets.Commands.ConnectVIServer
However, when I manually execute the same PowerShell command from a terminal on the same ZVM, I don’t have any issues. Therefore, it’s not a network flow or other similar problem…
Is there ant options that I can check to solve this issue ?
The message that comes back indicates a failure to resolve. Maybe the way the server’s FQDN/hostname is handed to the connect-viserver isn’t correct. I would try copying and pasting that line from the script right into PowerShell to see what happens.
You can check if the script’s execution environment in Zerto is different from the interactive PowerShell environment, such as environment variables or access permissions. slope ball
Thank you for taking the time to write and share the article! slice master
The forum ‘Scripting and APIs’ is closed to new topics and replies.