About VMware vSphere PowerCLI
vSphere PowerCLI is a command-line and scripting tool built on Windows PowerShell, and provides more than 200 cmdlets for managing and automating vSphere.
To use vSphere PowerCLI, you need to have installed the followming software:
- .NET 2.0, 3.0, or 3.5 with Service Pack 1
- Windows PowerShell 1.0/2.0
If .NET is installed without Service Pack 1, some operations might take long to complete.
vSphere PowerCLI 5.0 works on the 32-bit and 64-bit versions of the following operating systems:
- Windows 7
- Windows 2008 Server
- Windows Vista
- Windows XP Service Pack 2
- Windows Server 2003 Service Pack 2
The following PowerCLI features are supported only on the 32-bit versions of the supported operating systems.
Set-VM(only when used for applying customization specifications)
Set-HardDisk( only when used for resizing guest disk partitions)
vSphere PowerCLI 5.0 supports the following VMware environments:
- VMware ESXi 5.0
- vCenter Server 5.0
- VMware ESX 4.1 / vCenter Server 4.1
- VMware ESXi 4.1
- VMware ESX 4.0 Update 2 / vCenter Server 4.0 Update 2
- VMware ESX 4.0 Update 1 / vCenter Server 4.0 Update1
- VMware ESX 4.0i Update 1
- VMware VirtualCenter 2.5 Update 6
- VMware ESX 3.5 Update 5
- VMware ESXi 3.5 Update 5
- VMware ESX 3.0.3 Update1
What’s New in This Release?
This release of vSphere PowerCLI introduces the following new capabilities:
- Cloning templates with
- Copying files and folders from and to the guest operating system through the
- Joining domains through the
- Joining ESX hosts (version 4.1 and later) into an active directory through the
- Retrieving vCenter Server users and groups through the
- Support for vCenter Servers in linked mode through the
- Retrieving object properties through the
- Moving virtual appliances through the
- Importing compressed and chunked files through the
- Importing and exporting virtual appliances in OVA format.
- Support for the SSPI passthrough feature of VIX.
- Support for storage DRS: creating virtual machines and hard disks on datastore clusters and defining anti-affinity rules.(experimental)
vSphere PowerCLI 5.0 introduces three additional snapins of cmdlets that cover specific vSphere functionalities:
VMware.VimAutomation.License: The Licensing snapin contains the
Get-LicenseDataManagercmdlet for managing VMware License components..
VMware.ImageBuilder: The Image Builder snapin contains cmdlets for managing depots, image profiles, and VIBs.
VMware.DeployAutomation: The Auto Deploy snapin contains cmdlets that provide an interface to VMware Auto Deploy for provisioning physical hosts with ESXi software.
Support for PowerShell 1.0 will be removed in the next PowerCLI release.
For more information on changes made in vSphere PowerCLI 5.0, see the vSphere PowerCLI Change Log.
Obtaining the Software
You can obtain the vSphere PowerCLI 5.0 from here.
vSphere PowerCLI 5.0 is known to have the following issues:
- runs in asynchronous mode even when called without the
- throws an error when uploading an item to the root folder of a Datastore Provider drive.
- On vCenter Server 5.0,
- cannot change the storage format of the destination hard disk.
- might not return the actual datastore free space after a virtual machine is powered on. A refresh should be made first.
- On ESX 3.5,
- throws an error and does not create a datastore, although the specified
- disk partition is formatted with VMFS and you can run
- to create a datastore from the formatted partition.
- The value of the
- property of the object returned by
- is different depending on the way the hard disk is obtained by the cmdlet.
Get-NetworkAdapterdoes not throw an error message if you try to retrieve a nonexisting adapter.
Get-NetworkAdapterreturns only one object, when you try to retrieve existing network adapters by name from two virtual machines or snapshots.
- When you use
- to retrieve Powerpath devices, the value of their
- property is shown as
- parameter of
- does not accept
Get-UsbDevicedoes not work on ESX Server 3.5 Update 4 and ESX Server 3.5i platforms.
Get-UsbDevicecannot obtain USB devices from snapshots.
- If a nonexisting user is specified,
Get-VIEventreturns the events for all existing users.
- Objects returned by
ManagedObjectReferencetypes that are not compatible with the
- During the process of creating a template from a virtual machine,
Get-VMreturns both the virtual machine and template objects.
- If you try to retrieve virtual machines by their IDs and the list of the provided IDs contains the IDs of removed virtual machines,
Get-VMreturns no value.
- On vCenter Server 5.0,
- returns a result even if you pass a hashtable with inapplicable elements.
LocalPathparameter set of
Install-VMHostPatchdoes not work.
Install-VMHostPatchcannot install patches on diskless ESXi servers.
Install-VMHostPatchcannot install patches on ESX 3.5.
Install-VMHostPatchcannot apply VIB patches.
- When using
- to invoke multi-line BAT and BASH scripts, the command might not run all the script lines.
- does not ask for confirmation when you try to create a VMDK anti-affinity rule that overwrites an existing one.
- Cloning a server-side customization specification with
- changes the values of the
- properties from
- If you use
- to create a permission for a distributed switch, the
- property of the returned object is
- cannot configure the MAC address on VirtualCenter Server 2.5 and ESX 3.5 hosts.
- cannot set an annotation for a custom attribute if another custom attribute with the same name exists.
- Increasing the size of a system partition on Windows 7 and Windows 2008 by using the
- parameter of
- is not supported.
- disconnects the vCenter Server if the name you pass to the
- parameter already exists for another resource pool on the server.
Set-ScsiController (added to ref)
- cannot set both the
- parameters at the same time.
- Workaround: First run the cmdlet to set the type and then run it again to configure the bus sharing mode.
- , and
- parameters of
- do not work on ESX 4.0 and later.
- On vCenter Server 5.0, when you use Set-VM to upgrade the VM hardware version, the output of the cmdlet displays the old value although the version has been updated successfully.
- On Windows operating systems,
- becomes non-responding if the provided IP address conflicts with an existing IP address on the network.
- might not populate the
- property of the returned
- object when
- properties are modified.
- Workaround: Use
- to retrieve the object returned by
- cannot clear the values of the
- properties of the input object.
- If you have vMotion enabled on one VMKernel nic and you enable it on a second nic on the same switch (using Set-VMHostNetworkAdapter), ‘VMotionEnabled’ property of the second nic may still report that vMotion is not enabled. This is due to the fact that there can only be one nic selected for vMotion, but more than one can be ‘candidate’ nics for vMotion. In the described scenario the second nic will become a ‘candidate’ nic for vMotion. If you want to change the currently active vMotion nic – first disable the current one and then enable the one you want.
- Changing the value of the
- parameter to
- changes the value of the
- parameter to
- as well.
- cannot configure correctly the DNS address on Linux operating systems.
- The default value of the
TargetPortparameter is a random number instead of the port number.
Set-VMHostSNMPskips the value of the
Set-VMHostSNMPfails to enable
VMHostSNMPand to set the
ReadOnlyCommunityStringwhen called for the first time.
Workaround: Run the command again.
- When run within the Inventory Provider,
- returns the datacenters from the default servers instead from the
- folder of the Inventory Provider drive.
- The examples in section “Use ESXCLI with PowerCLI” in the PowerCLI 5.0 User’s Guide, are not applicable to ESX versions later than 4.0.
- On vCenter Server 5.0/ ESXi 5.0 platforms, all guest-related cmdlets have slow and unstable behavior due to the slow performance of VMware Tools.
VirtualMachineparameter of the PowerCLI cmdlets is defined with the deprecated
Descriptionproperty of the
VirtualMachinetype, instead of the new one named
Notes. In result, The PowerShell auto-complete function works with the deprecated property name.
- The types labels in the
UpdateViewDataproperty are case-sensitive.
- When running in 64-bit mode, PowerCLI cannot detect the registry key
HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware vSphere PowerCLI\, which is used for determining the PowerCLI installation folder. Instead, you can use the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMware vSphere PowerCLI.
Vendorproperties of the
ScsiLunobjects are always filled up with white-spaces to 16 (for
Model) and 8 (for
- All VIX cmdlets support using SSPI for Windows guest machines if the underlying vCenter Server is 5.0 version. This might not be valid for users who are local, and not domain users. VIX cmdlets are
Set-HardDiskwhen used for guest disk resizing.
The following issues have been resolved in vSphere PowerCLI 5.0:
- If a
ManagedObjectReferenceobject that points to
StorageResourceManageris specified for the
Get-Viewreturns no result.
Get-Viewfails to retrive
Clusterviews if HA is enabled.
- throws an error if there is a disconnected network adapter.
- On Windows operating systems, the
- property of the objects returned by
- is incorrect.
- On 64-bit operating systems,
Invoke-VMScriptworks only in 32-bit mode.
Invoke-VMScriptdoes not work if the guest operating system is installed on a drive other than
Invoke-VMScriptagainst outdated VMware Tools might make the console non-responsive.
Invoke-VMScriptmight become non-responding.
New-OSCustomizationSpecclones only the first object if an array of objects is provided.
- VMware vClient shows an error message
Error reading passwordwhen opening specifications that are created by
New-OSCustomizationSpecwith empty passwords.
- When run with the
- switch parameter set to
- creates a snapshot with
- property set to
Set-HardDiskfails to resize the hard disk, if the helper virtual machine cannot access the datastore where the target hard disk is located.
Set-HardDiskfails to resize the hard disk, if the power state of the helper virtual machine is powered on.
Workaround: Refresh the helper virtual machine object before running
- does not set a persistent proxy policy.
Set-VMcannot modify the
DrsAutomationLevelproperty of the virtual machine if the current value of the property is
Set-VMaccepts only values that are powers of 2 for the
- On Linux Red Hat 5,
Set-VMGuestNetworkInterfacecannot set static DNS addresses.
Set-VMGuestNetworkInterfacecannot set the
- On Linux operating systems,
- cannot modify routes.
- Workaround: Remove all guest routes and then add them one by one.
- cannot configure
vSphere SDK for .NET
- property of the
- object is not populated.
Installing vSphere PowerCLI
VMware provides a single installer for vSphere PowerCLI.
To install vSphere PowerCLI
- Download vSphere PowerCLI 5.0.
- Launch the vSphere PowerCLI installer by double-clicking the executable file. In the Welcome page, click Next.
- To install vSphere PowerCLI in a non-default location, click Change in the Destination Folder page and select a different directory.
- In the Ready to Install the Program page, choose whether to create a desktop shortcut.
- Click Install to proceed with the installation.
- Click Finish to complete the installation process.
Source : VMware