Reply to Message

View discussion in a popup

Replying to:
jravnsba1
Contributor
Contributor

Create alias in $profile to connect to all vCenters

Is is possible to create an alias in $profile to connect to all your vCenters ?

I have tried but it doesn't work as expected:

$credential = import-clixml -path 'C:\documents\PowerCLI\My-credfile.xml'

$vCenterServers = @("vcsa1","vcsa2","vcsa3","vcsa4","vcsa5")

new-alias allvc connect-viserver $vCenterServers -Credential $credential

If I run it from commandline it works:

$credential = import-clixml -path 'C:\documents\PowerCLI\My-credfile.xml'

$vCenterServers = @("vcsa1","vcsa2","vcsa3","vcsa4","vcsa5")

connect-viserver $vCenterServers -Credential $credential

Joern Ravnsbaek
Reply
0 Kudos