Using VMware PowerCLI - Issue with OO powershell operation that failed to run in parallel
Since the OO (9.07) out of box Integration pack for VMware infrastructure is not including all VM configuration options (like VM set annotation/folder search etc..) I decided to try using PowerCLI with Powershell command.
It worked pretty good, and as mention before ,there are a lot of things you can do with powershell and PowerCLI.
however , I encountered in a very strange behavior while running this simple powershell script flow:
Connect-VIServer -Server 10.10.10.10 -User user-Password pass
Set-Annotation -Server 10.10.10.10 -Entity "vmName" -CustomAttribute "Case Number" -Value 12345
Disconnect-VIServer -Server 10.10.10.10 -Force -Confirm:$false
when running this flow from two different users/PC in parallel on two different Virtual Machines VM1 & VM2 ,I'm getting this error :" Could not execute powershell command. At line:4 char:15 + Set-Annotation <<<< -Server 10.10.10.10 -Entity "VM1" -CustomAttribute "Customer Email" -Value 12345 ---> VMware.VimAutomation.ViCore.Types.V1.ErrorHandling.InvalidState: You have modified the global:DefaultVIServer and global:DefaultVIServers system variables. This is not allowed. Please reset them to $null and reconnect to the vSphere server "
also if I'm not using default variable by adding "-NotDefault" flag to the Connect-VIServer command I'm getting java error : "Connection reset at java.net.SocketInputStream.read..."
meaning somehow the parameters of the first flow is being changed by the 2nd flow run .so the 1st run is crashed in OO Central while the 2nd flow run is completed successfully with no errors.
Does anyone have any ideas how I can prevent OO from resetting powershell parameters of two different flow runs?
Does anyone encountered this exception before ?