Powershell is an interactive command-line interpreter, much like the familiar DOS prompt, or the shell environment in UNIX.
What really sets Powershell apart from other command-line environments is that applications are being built with Powershell manageability expressly in mind, which means that in the Windows world. Powershell will become increasingly important for managing large numbers of servers and applications.
You can use powershell for managing VMware environments, handling large virtual machines is very tideous task for administrators.
PowerCLI is a Windows PowerShell interface for managing VMware vSphere.
VMware describes PowerCLI as "a powerful command-line tool that lets you automate all aspects of vSphere management, including network, storage, VM, guest OS and more. PowerCLI is distributed as a Windows PowerShell snapin, and includes over 370 PowerShell cmdlets for managing and automating vSphere and vCloud, along with documentation and samples.
In this blog, I will cover some cmdlets
1. Connect-VIServer: To connect to any vSphere connect, you need to use connect-viserver.
Example: Connect-VIServer -server 10.0.0.2 -User Shanky\admin
This examples connects to you shell to VI server at 10.0.0.2. You can mention username and password
2. Get-VIServer: Before you can do any VMware management from
PowerShell you must first connect to a VC server or ESX host.
Example: Get-VIServer 10.0.0.2
This example connected machine is VI server at 10.0.0.2 . In order to complete the
connection you will be asked for a user name and password.
3. Get-VM: This VMware cmdlet retrieves managed virtual machines.
Example: Get-VM | select name, memorymb
This example: displays all VMs in the virtual infrastructure, along with the
amount of memory allotted to the VM.
4. Get-VMHost: This VMware cmdlet retrieves VM hosts (
Example: Get-VMHost | select name
This example creates custom report about all VM hosts that are available in the
virtual infrastructure.
No comments:
Post a Comment