Friday, August 16, 2013

How to Install vSphere PowerCLI

Information about How to Install vSphere PowerCLI 
This document will describe the how to download and run basic vSphere PowerCLi commands. 
  • vSphere PowerCli is a PowerShell Snapin that lets you connect to vCenter server and run scripts or cmdlets.
  •  VMware vSphere PowerCLI provides a Windows PowerShell interface to the vSphere API.
  • vSphere PowerCLI includes PowerShell Cmdlets (pronounced, “command-lets”) for administering vSphere components. In addition, the vSphere PowerCLI package includes the vSphere SDK for .NET for developers who want to create their own applications.   
Document Creator    Modified 
Todd Walters        05/05/10 
  • Should have PowerShell 2.0 installed 
  • If you are writing a PowerShell, you'll have to add add-PSSnapin VMware.VimAutomation.Core to initiate VM CLI 
  • Once installed, you'll must run connect-viserver to connect to vCenter server before running commands.  
How to Download vSphere PowerCLI  
 
How to Install and Generate list of Installed VM 

  1. Download  vSphereCLI  located here: Download vSphereCLI  
  2. Follow the instructions to download and install.  
  3. Once installed launch vSphere PowerCLI  
  4. vspherecli and connect to vcenter by typing 'connect-viserver'  
  5. At the Server[0] prompt enter srv0sm090, at Server[1] just press enter to return to cmdline. 
  6. Next, type get-vm > c:\temp\vmlist  to generate a list of all vms' 
  7. That's all, it's that simple. 
Quick Install Guide

Setup PowerShell/PowerCli

Configure Powershell on Windows7 
  • Go start > search > type ‘powershell’ and drag PowerShell ISE to desktop for shortcut. 
Download Quest Active Roles 
  • http://www.quest.com/powershell/activeroles-server.aspx 
Download PowerCLI 

  • https://my.vmware.com/web/vmware/details/sdkwin40u1/ZHcqYmQlcHRiZGVqd


  1. Run set-executionPolicy unrestricted  (allow unsigned scripts) 
  2. Setup PowerShell Profile 
  3. run $profile  which should show you path in middle pane  
  4. run test-path $profile and will probably return False since there's no profile created yet.  
  5. run this New-Item -path $profile -type file -force  
  6. This will create a new profile file, otherwise next step would fail  
  7. Run notepad $profile and edit the file as you want. I just added in this  
    •  add-pssnapin Microsoft.Exchange.Management.PowerShell.Admin  
    •  add-pssnapin quest.activeroles.admanagement  
    • add-PSSnapin VMware.VimAutomation.Core  
    • set-location c:\scripts  

No comments:

Post a Comment