Now that we have a new version of PowerCLI being developed, could we get you all to add compatibility for PowerCLI cmdlets with the PoshRSJob module? I have been struggling with this for about a year now, and I think this may be the opportunity to actually get it done. Any and all help is greatly appreciated.
I use the attached script and get the following error from most jobs. It has something to do with the global DefaultVIServer and DefaultVIServers variables, but I haven't been able to find a way around it...
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.
Shipped in PowerCLI 12.2
This drives me crazy as well since I run things against 40+ vCenter servers and thats not fun anymore. The only thing is to use Out Of Process Runspaces.
@Cole - I modified your code using out of process runspaces. It should work now. Read comments in file for more details.
I hope this unpleasant PowerCLI behavior will be solved soon.
@Jake - Negative. I tried that yesterday and the jobs take much longer than they should or you would expect, and the results aren't consistent. Some jobs still throw some weird errors. All of that was seen with the throttle set to 10. Not sure what kind of results you'd see if you tried any more than that.
Will `Connect-VIServer -Session <SessionID>` not help with this?
Great idea!
Suggest to make it more general, "support Runspaces".