How to do it…

First, download and install PowerCLI, then perform the following steps:

  1. Open your favorite browser and go to https://www.vmware.com/downloads.
  2. Click on the VMware vSphere.
  3. Go to the Drivers & Tools tab.
  4. Expand the Automation Tools and SDK(s) section.
  5. Click on the VMware PowerCLI 6.5 Release 1 link.
  6. Click on the Download link and log in to begin the download.
  7. Once downloaded, start the installer.
  8. Take the default installation options or adjust as required.

Now that you have installed PowerCLI, run it and connect it to your vCenter server:

  1. Run the VMware PowerCLI shortcut from your desktop.
  2. If you get an error about scripts being disabled on the system, follow the instructions at http://go.microsoft.com/fwlink/?LinkID=135170 to fix the issue.
  3. Close PowerCLI and reopen it. Say Always run to the Initialize-PowerCLIEnvironment.ps1 script.
If you get a message similar to Unable to find type [VMware.VimAutomation.sdk.Util10.ProductInfo], restart your system and run PowerCLI again.
  1. Now that you have PowerCLI started, run the following script to connect to your vCenter Server:
Connect-VIServer <vCenter server name>
  1. This script will automatically use your local Windows credentials to connect to the vCenter Server. If your local Windows credentials don't have permissions to log in to it, you will be prompted for a username and password.
  2. The output should be similar to the following:
  1. Now that you are connected to vCenter, run a simple script to list your hosts:
Get-VMHost

This is the expected output of the command. In the next recipe, we will explore more PowerCLI scripts.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.205.154