The “Back to Basics” (B2B) blog post series will be showing people new to PowerShell and PowerCLI how to get started, they will be an ongoing feature on the PowerCLI blog and will cover each aspect of managing your virtual infrastructure with PowerShell and PowerCLI.
To get us started we have gone back to the beginning – Installing PowerCLI.
PowerCLI is typically installed on a vSphere administrators Microsoft Windows based desktop system or anywhere where you may currently run the vSphere Client, PowerCLI will access the vSphere API in a similar way to the vSphere Client so the same ports and access rights are needed to your vCenter or vSphere host.
In order to support installing PowerCLI to a desktop system the following prerequisites software packages must be present:
· Windows .Net Framework 2.0 (3.5 latest SP Recommended)
· Windows PowerShell (V2 Recommended)
Windows PowerShell V2 is integrated with Windows 7 and Windows 2008 R2, previous operating systems such as Windows XP, Windows Vista, Windows 2008 (Non R2) and Windows 2003 are compatible with Windows PowerShell, this must be first downloaded and installed from the following website: http://support.microsoft.com/kb/968929
After checking all pre-requests’ are installed you must set the 'Execution Policy' of PowerShell to enable it to be able to run scripts. By default PowerShell is installed in secure mode, which will disable the running of scripts within PowerShell.
To change the 'Execution Policy' start a PowerShell session with Administrator Privileges:
From the Window's Start menu type 'PowerShell', once the PowerShell program is displayed on the start menu Right Click 'Windows PowerShell' and select 'Run as administrator'.
A PowerShell prompt will be started:
It is recommended that you read more about PowerShell's different execution policies, to find out more information about these and ensure you change this to the correct setting for your organization enter get-help about_Execution_Policies at the PowerShell prompt.
In this guide we will change the execution policy to RemoteSigned.
From the PowerShell prompt enter: Set-ExecutionPolicy RemoteSigned
You will then receive information about execution policies and a prompt asking you to confirm your action before changing the execution policy, enter Y at the prompt and press enter.
You will then be returned to the PowerShell prompt with the change being completed. Type Exit and press Enter to leave the PowerShell prompt, this will need to be completed for both 32bit and 64bit PowerShell sessions.
You will now be ready to install VMware vSphere PowerCLI.
Download the PowerCLI software to your workstation from the following URL: http://vmware.com/go/PowerCLI
Once the software has been downloaded, start the install by double clicking the PowerCLI exe file.
The installer will firstly notify you that the additional component 'VMware VIX' will be installed as part of the PowerCLI install, click OK.
If you have not yet set your execution policy correctly an information box will appear advising you that this will need to be set to RemoteSigned before PowerCLI will execute correctly. Click the Continue button.
If the execution policy is set correctly this box will not appear.
This will bring you to the Welcome screen:
The welcome screen will now be shown welcoming you to the install wizard for PowerCLI, click Next to continue.
This will bring you to the VMware Patents:
Click Next to continue. This will bring you to the License Agreement:
Select the option ‘I accept the terms in the license agreement’ & then click Next to continue.
This will bring you to the Destination Folder:
Select the drive you would like to install PowerCLI onto and the folder name or leave this set as the recommended path and click Next.
This will bring you to Ready to install:
Click Install to begin the Install of PowerCLI.
This will bring you to Installing VMware vSphere PowerCLI
Please wait while the installation completes.
ight="484" src="/tp/.a/6a00d8341c328153ef0154332fa798970c-pi" style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" width="637" />
When the install is successful, the Finish screen will be displayed. To complete the installation click Finish.
The PowerCLI installation will now be completed and on your desktop you will now have two icons, which allow you to launch PowerCLI, a 64 bit version and a 32 bit version.
On your start menu in the Start –> All Programs –> VMware -> VMware vSphere PowerCLI folder you will now have access to the following items:
- VMware vSphere PowerCLI (32-Bit)
- VMware vSphere PowerCLI
- vSphere PowerCLI Admin Guide
- vSphere PowerCLI Cmdlets Reference
- vSphere SDK for .NET API Reference
- vSphere SDK for .NET Dev Guide
It is highly recommended that you read the ‘vSphere PowerCLI Admin Guide’ as this will provide the fundamentals of both PowerCLI and PowerShell and will aid in the learning process when starting out with PowerCLI.
B2B Part 1 FAQs
Q. Can I install PowerCLI on my vCenter Windows Server ?
A. Yes but normally it will be installed on your management PC or a server specifically setup to run scheduled PowerShell tasks, keep in mind that complex scripts may cause high CPU and memory usage which could impact other running programs on the same computer.
Q. How do I find out more about the Execution Policy ?
A. You can read more about PowerShell's different execution policies and ensure you choose the correct setting for your organization by typing get-help about_Execution_Policies at the PowerShell prompt.