[英]Is it possible to run Vmware PowerCLI from Remote Powershell Session?
> PS C:\Users\cwip0989\Documents> Enter-PSSession -ComputerName AB-NPC1-D1B099 -Credential cwip0989
[AB-NPC1-D1B099]: PS C:\Users\cwip0989\Documents> C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noe -c ".\"
'C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\'""
The remote pipeline has been stopped.
+ CategoryInfo : ResourceUnavailable: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException
[AB-NPC1-D1B099]: PS C:\Users\cwip0989\Documents> C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noe -c ".\"
'C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1\'""
The remote pipeline has been stopped.
+ CategoryInfo : ResourceUnavailable: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException
我相信Powershell腳本畢竟有一些限制。
我也發現一件事,遠程Powershell版本始終是2.1 ...
[AB-NPC1-1B094]: PS C:\> $psversiontable
Name Value
---- -----
CLRVersion 2.0.50727.5485
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
SerializationVersion 1.1.0.1
PSRemotingProtocolVersion 2.1
請看一下invoke-vmscript
,它可用於在遠程服務器上運行命令,而無需執行pssession。 但是,這不會在台式機的powershell或powercli中為您提供命令的輸出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.