Hello:
I know that I can open multiple connections to VCs (Connect-VIServer), but do not really understand how to operate with them…
How can I refer to VC1 for one operation and after that to VC2 for another without closing connection to VC1? I might need to do it few times in my script…
Any help and simple example will be really appreciated.
Thanks,
qwert
The Connect-VIServer cmdlet from PowerCLU 4u1 onwards supports multiple open sessions.
The sessions are stored in an array called $defaultVIServers.
If you need to re-establish an open session you can use the entry for that server in the array and then use the SessionId property to make that session the open/default session (which is stored in the $defaultVIServer variable).
Something like this
Connect-VIServer -Server VC1 Connect-VIServer -Server VC2 # Show the sessions and their properties $defaultVIServers | Select * # Open the session to VC1 Connect-VIServer -Session $defaultVIServers[0].SessionId # Open the session to VC2 Connect-VIServer -Session $defaultVIServers[1].SessionId # The open session $defaultVIServer
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The Connect-VIServer cmdlet from PowerCLU 4u1 onwards supports multiple open sessions.
The sessions are stored in an array called $defaultVIServers.
If you need to re-establish an open session you can use the entry for that server in the array and then use the SessionId property to make that session the open/default session (which is stored in the $defaultVIServer variable).
Something like this
Connect-VIServer -Server VC1 Connect-VIServer -Server VC2 # Show the sessions and their properties $defaultVIServers | Select * # Open the session to VC1 Connect-VIServer -Session $defaultVIServers[0].SessionId # Open the session to VC2 Connect-VIServer -Session $defaultVIServers[1].SessionId # The open session $defaultVIServer
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference