I occasionally get this error:
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.
I have tried to fix the issue with this piece of code:
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Confirm:$false | Out-Null
Set-PowerCLIConfiguration @Settings -Confirm:$false
I still get the error from time to time. How can I avoid this error?
I expose some functionality through a webservice, asp.net mvc.
Each user can then call some functions in a powershell script which resides on the webservice server.
A new powershell instance is created for each powershell function call. Multiple instances may be executing simultaneously.