Wednesday, 1 January 2014

VMWare Power CLI..

1. How to connect VC ?
Ans- Connect-VIServer -Server 10.0.200.10 -User administrator -Password xxxx

2. View all virtual machines on the target system.
Get-VM

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-VM –Destination Host02.

8. View all hosts on the vCenter Server system that you have established a connection with.
Get-VMHost

9. Add the Host standalone host.
Add-VMHost -Name Host -Location (Get-Datacenter DC) -User root -Password pass

Manage Virtual Machine Templates on vCenter Server

1 Create a template from the VM1 virtual machine.
New-Template -VM VM1 -Name VM1Template -Location (Get-Datacenter DC )

2 Convert the VM1Template template for use by a virtual machine named VM3.
Get-Template VM1Template | Set-Template -ToVM -Name VM3

3 Create a template from the VM2 virtual machine.
New-Template -VM VM2 -Name VM2Template -Location (Get-Datacenter DC )
Chapter 5 Sample Scripts for Managing vSphere with VMware vSphere PowerCLI
VMware,

4. Convert the VM2Template template to a virtual machine named VM4.
Get-Template VM2Template | Set-Template -ToVM -Name VM4

5 Convert the VM4 virtual machine to a template.
Set-VM –VM VM4 –ToTemplate –Name “VM4Template”

6 Create a template called VM3Template by cloning VM2Template.
Get-Template VM2Template | New-Template -Name VM3Template –VMHost $targetVMHost

No comments:

Prasanta Kumar Behera. Mob- 8147470101