VMWare Workstation と PowerShell の初心者向けの知識があります。
vmrun
このツールを使用して、ローカル マシンで VM を正常に起動するスクリプトを作成しました。ただし、リモート セッションで実行しても何も起こりません。理由はありますか?
Get-PSSession | Remove-PSSession
$VMHostMachine | New-PSSession
$rs = Get-PSSession # testing using localhost
Write-Debug ("Now starting VM on host: " + $VMHostMachine)
$script = {param($VMImagePath, $VMConsolePath);
$QuotedVMPath = "`"{0}`"" -f $VMImagePath
$Result = Start-Process -FilePath $VMConsolePath -ArgumentList "-T", "ws", "start", $QuotedVMPath -Wait -PassThru -NoNewWindow
}
Invoke-Command -Session $rs -ScriptBlock $script -ArgumentList $vmConfig.VMImagePathOnHost, $vmConfig.VMRunUtiltyPath
Invoke-Command
セッションパラメータを削除すると機能します:
Invoke-Command -ScriptBlock $script -ArgumentList $vmConfig.VMImagePathOnHost, $vmConfig.VMRunUtiltyPath
PSSession を介してローカルホストのスナップショットに正常に戻る同様のスクリプトがあるのに、VM を起動すると問題が発生するのはなぜですか?