Search This Blog

Friday, May 27, 2011

POWER CLI


PowerCLI
To connect to esx or vCenter server:
Connect-VIServer    -Server <ipadress or DNS name>   or
Connect-VIServer    -Server <ipadress>  -Protocol   https –User  admin(root)   -Password <something>
After a connection is established, you are ready to run the VSphere PowerCLI cmdlets.
Important commands are (on virtual machines):
Get-VM
Set-VM
New-VM
Add-VM
Remove-VM
Eg:  To start a specific vm:
Get-VM -name <VMName> | Start-VM
To stop a Virtual machine:
Get-VM -name <VMName> | Stop-VM
To remove a vm:
1)      Remove-v –VM “vm1”,”vm2”…………..
2)      Get-vm –Name “vm1” | Remove-vm
3)      Remove-vm –vm  (Get-vm –name “vm1”)

No comments:

Post a Comment