Thursday, July 14, 2016

Manage Virtual Machines on vSphere

With vSphere PowerCLI, you can automate various administration tasks on virtual machines, for example retrieving information, shutting down and powering off virtual machines.
1
View all virtual machines on the target system.
Get-VM
2
Save the name and the power state properties of the virtual machines in the ResourcePool resource pool into a file named myVMProperties.txt.
$respool = Get-ResourcePool ResourcePool
Get-VM -Location $respool | Select-Object Name, PowerState > myVMProperties.txt
3
Start the VM virtual machine.
Get-VM VM | Start-VM
4
Get information of the guest OS of the VM virtual machine.
Get-VMGuest VM | fc
5
Shut down the OS of the VM virtual machine.
Shutdown-VMGuest VM
6
Power off the VM virtual machine.
Stop-VM VM
7
Move the virtual machine VM from the Host01 host to the Host02 host.
Get-VM -Name VM -Location Host01 | Move-VMDestination Host02

No comments:

Post a Comment

Thanks for showing interest in tech-jockey.

Content of this blog has been moved to GITHUB

Looking at current trends and to make my content more reachable to people, I am moving all the content of my blog https://tech-jockey.blogsp...