我需要在脚本中建立vcenter服务器连接会话。.我具有connect-VIServer cmdlet以连接到vcenter服务器。但是,我无法在整个脚本中进行和维护会话。我需要重用这些vcenter服务器会话。
$vcsession = Connect-VIServer -Server xxxx
Import-PSSession -Session $session
Import-PSSession : Cannot bind parameter 'Session'. Cannot convert the "xxxxx.xxx.com" value of type "VMware.VimAutomation.ViCore.Impl.V1.VIServerImpl" to type "System.Management.Automation.Runspaces.PSSession".
Enter-PSSession -Session $vcsession
Enter-PSSession : Cannot bind parameter 'Session'. Cannot convert the
"xxxx.xxx.com" value of type
"VMware.VimAutomation.ViCore.Impl.V1.VIServerImpl" to type "System.Management.Automation.Runspaces.PSSession".
New-PSSession -Session $session.SessionSecret
New-PSSession : Cannot bind parameter 'Session'. Cannot convert the ""b4b7be33bcace66b284f60ed09c86d83e119f1ff"" value of type "System.String" to type "System.Management.Automation.Runspaces.PSSession".At line:1 char:24