Hi All,
I am trying to run the PowerCLI in a remote powershell session. Connecting to vSphere works just fine however some of the cmdlets just hangs. I checked with Fiddler and it appears that the vSphere actually returns the data.
Does anybody an experiences with this?
I can reproduce it with
$script = {
Add-PSSnapin VMware.VimAutomation.Core
Add-PSSnapin VMware.VimAutomation.Vds
. "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1"
Connect-VIServer <vsphere>
Get-Folder
}
# This works just fint
Invoke-Command $script
$session = New-PSSession localhost
# This just hangs.
Invoke-Command -Session $session $script
If I create an interactive session (using enter-pssession), I can actually get it to work just fine. However enter-pssession is not great for automation.
with regards,
Thomas