So, I am having some troubles setting up a connection to multiple servers at the same time.
Here is the current configuration pulled using Get-PowerCLIConfiguration
I have tried to connect using:
"Server1",
"Server2
);
$user="me"
$password="mypassword"
Connect-VIServer -Server $hosts -User $user -Password $password
After displaying the contents of the $defaultviservers array, it changes to the last server that it had connected to and never more than just the one.
Some thoughts on this would be appreciated.
Try setting the DefaultVIServerMode to Multiple for the Session and User scope as well.
The priority is Session-User-AllUsers (high to low)
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope ([VMware.VimAutomation.ViCore.Types.V1.ConfigurationScope]::User)
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope ([VMware.VimAutomation.ViCore.Types.V1.ConfigurationScope]::Session)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
A very easy way.
http://professionalvmware.com/2011/03/some-powercli-101-connecting-to-multiple-vcenters/
To choose which one to connect, use -menu
The problem I have with this is that I am going to be setting up an automated task which will run a PowerCLI script. I will not have the option of user entry at all.
Try setting the DefaultVIServerMode to Multiple for the Session and User scope as well.
The priority is Session-User-AllUsers (high to low)
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope ([VMware.VimAutomation.ViCore.Types.V1.ConfigurationScope]::User)
Set-PowerCLIConfiguration -DefaultVIServerMode Multiple -Scope ([VMware.VimAutomation.ViCore.Types.V1.ConfigurationScope]::Session)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference