1.Get-VMGuest
功能:检索指定虚拟机的客户操作系统。
语法:
Get-VMGuest [-VM] <VirtualMachine[]> [-Server <VIServer[]>] [<CommonParameters>]
例子:
Get-VMGuest -VM winxp
2.Restart-VMGuest
功能:重新启动虚拟机的客户机操作系统。
语法:
Restart-VMGuest [[-VM] <VirtualMachine[]>] [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Restart-VMGuest [[-Guest] <VMGuest[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Get-VM winxp | Restart-VMGuest
3.Shutdown-VMGuest
功能:关闭指定的虚拟机的客户机操作系统。
语法:
Shutdown-VMGuest [[-VM] <VirtualMachine[]>] [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Shutdown-VMGuest [[-Guest] <VMGuest[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Get-VM winxp | Shutdown-VMGuest
4.Suspend-VMGuest
功能:暂停虚拟机
语法:
Suspend-VMGuest [[-VM] <VirtualMachine[]>] [[-Server] <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Suspend-VMGuest [[-Guest] <VMGuest[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Get-VM VM| Suspend-VMGuest
5.Update-Tools
功能:升级指定虚拟机的客户机操作系统的VMwareTools
语法:
Update-Tools [-NoReboot] [-RunAsync] [[-Guest] <VMGuest[]>] [<CommonParameters>]
Update-Tools [-NoReboot] [-RunAsync] [[-VM] <VirtualMachine[]>] [[-Server] <VIServer[]>] [<CommonParameters>]
例子:
(1)
Update-Tools VM
(2)
Get-VMGuest VM | Update-Tools
6.Mount-Tools
功能: 安装vmware tools
语法:
Mount-Tools [[-Guest] <VMGuest[]>] [<CommonParameters>]
Mount-Tools [[-VM] <VirtualMachine[]>] [[-Server] <VIServer[]>] [<CommonParameters>]
例子:
(1)
Mount-Tools VM
(2)
Get-VMGuest VM | Mount-Tools
7.Dismount-Tools
功能:卸载VMware Tools
语法:
Dismount-Tools [[-Guest] <VMGuest[]>] [<CommonParameters>]
Dismount-Tools [[-VM] <VirtualMachine[]>] [[-Server] <VIServer[]>] [<CommonParameters>]
例子:
(1)
Dismount-Tools VM
(2)
Get-VMGuest VM | Dismount-Tools
8.Copy-VMGuestFile
功能:使用VMware Tools将文件复制到指定的虚拟机
语法:
Copy-VMGuestFile [-Source] <String> [-Destination] <String> -GuestToLocal [-Force] [-VM] <VirtualMachine[]> [-HostCredential <PSCredential>] [-HostUser <String>] [-HostPassword <SecureString>] [-GuestCredential <PSCredential>] [-GuestUser <String>] [-GuestPassword <SecureString>] [-ToolsWaitSecs <Int32>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Copy-VMGuestFile [-Source] <String> [-Destination] <String> -LocalToGuest [-Force] [-VM] <VirtualMachine[]> [-HostCredential <PSCredential>] [-HostUser <String>] [-HostPassword <SecureString>] [-GuestCredential <PSCredential>] [-GuestUser <String>] [-GuestPassword <SecureString>] [-ToolsWaitSecs <Int32>] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
例子:
Copy-VMGuestFile -Source c:\text.txt -Destination c:\temp\ -VM VM -GuestToLocal -HostUser root -HostPassword pass1 -GuestUser user -GuestPassword pass2