Absent Member.. Absent Member..
Absent Member..

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 -User user-Password  pass

Set-Annotation -Server -Entity "vmName" -CustomAttribute "Case Number" -Value 12345

Disconnect-VIServer -Server -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 -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 ?


Labels (1)
1 Reply
Absent Member.. Absent Member..
Absent Member..

I solved the issue myself .

I moved the script to a background job , this way I can run multiple time same flow without any error or variable resetting.

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.