导出虚拟机列表
$new_vm_name = "hostname"
$server_User = ".\administrator"
$server_PWord = ConvertTo-SecureString –String "Password" –AsPlainText -Force
$server_Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $server_User, $server_PWord
$new_vm_session = New-PSSession -ComputerName $new_vm_name -Credential $server_Credential
invoke-command -session $new_vm_session -scriptblock{
Get-VM >> C:\VMs.txt
}