Managing the guest OS
In this category, we will discuss how to manage the guest OS of a VM using PowerCLI. To manage the different aspects of the guest OS, we can use the following cmdlets:
Get-VMGuest
Restart-VMGuest
Stop-VMGuest
Suspend-VMGuest
Copy-VMGuestFile
Get-VMGuestNetworkInterface
Set-VMGuestNetworkInterface
Get-VMGuestRoute
New-VMGuestRoute
Remove-VMGuestRoute
Invoke-VMScript
We can use the Get-VMGuest
cmdlet to get the guest operating system of the VM. Using the next three cmdlets, that is, Restart-VMGuest
, Stop-VMGuest
, and Suspend-VMGuest
, we can control the power state of a VM guest operating system. The Get-VMGuest
cmdlet gives the current status of a VM guest. Similarly, we can use the restart
, stop
, and suspend
cmdlets to restart, stop, and suspend the state of a virtual machine:
PS C:\> Get-VMGuest "LAB AD" State IPAddress OSFullName ----- --------- ---------- Running {fe80::acd6:aa2f...