Hello folks,
I encountered error today on my code as shown error msg below, can someone help me on this pls?
Am trying to connect to multiple vcenter servers assigned to $VIServer variable.
Error:
Connect-VIServer : Invalid URI: The hostname could not be parsed.
At C:\PS_SCRIPTS\berns\getvminfo.ps1:30 char:1
+ Connect-VIServer $VIServer -User $user -Password $pass -WarningAction
SilentlyCo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : NotSpecified: (:) [Connect-VIServer], UriFormatE
xception
+ FullyQualifiedErrorId : System.UriFormatException,VMware.VimAutomation.V
iCore.Cmdlets.Commands.ConnectVIServer
Snippet:
# Credential
$user="dom\testid"
$pass="pass"
# All current Virtual Centers to check
$VIServer="vc1, vc2, vc3"
# Connect to Virtual Center servers
Connect-VIServer $VIServer -User $user -Password $pass -WarningAction SilentlyContinue |out-Null