April 24

Reading The F****** Manual: Setting Up VMware PowerCLI 10.x

lIf you visit the vmware.com/download website you’d be forgiven for thinking that PowerCLI is now on version 6.5 Release 1

However, you would be wrong because a blogpost in Nov, 2017 announced the release of 6.5.3, which downloadable from this community page:

https://communities.vmware.com/community/vmtn/automationtools/powercli

But wait.

Hang on. Uh-oh.

Wrong again.

The latest and greatest version of PowerCLI is actually version 10. And is downloadable using generic PowerShell commands from the PowerShell Gallery.

https://blogs.vmware.com/PowerCLI/2018/02/powercli-10.html 

https://www.powershellgallery.com/packages/VMware.PowerCLI/10.0.0.7895300

Confused?

Do keep up…

Your supposed to just know this by reading some obscure blogpost which links you to the PowerShell Gallery with positively NO instructions on how to set it up. Man, someone could really do with RTFM this – to make it easy for new people to get hold of.

So.. Drum roll here’s how its done.

1. Run PowersHell from your system – ensuring that use RunAs Administrator:

2. Type

Install-Module -Name VMware.PowerCLI

3. Choose [Y] to download and install the Nuget update engine

4. Chose [A] to get download all of the PowerCLI modules

5. Make a cup of tea whilst stuff downloads and unzips itself

6. Once this completes. Your not done yet. Just because the modules have been download and unzip – that doesn’t mean they have been loaded. That’s something you’ll need to do yourself. If you simple type connect-viserver you will get an error message like so:

There are lots of modules that contain lots of cmdlets (is that CMD-lets or “Command-Lets?)

VMware.VimAutomation.Sdk (≥ 10.0.0.7893910)
VMware.VimAutomation.Common (≥ 10.0.0.7893906)
VMware.VimAutomation.Core (≥ 10.0.0.7893909)
VMware.VimAutomation.Srm (≥ 10.0.0.7893900)
VMware.VimAutomation.License (≥ 10.0.0.7893904)
VMware.VimAutomation.Vds (≥ 10.0.0.7893903)
VMware.VimAutomation.Vmc (≥ 10.0.0.7893902)
VMware.VimAutomation.Nsxt (≥ 10.0.0.7893913)
VMware.VimAutomation.vROps (≥ 10.0.0.7893921)
VMware.VimAutomation.Cis.Core (≥ 10.0.0.7893915)
VMware.VimAutomation.HA (≥ 6.5.4.7567193)
VMware.VimAutomation.HorizonView (≥ 7.1.0.7547311)
VMware.VimAutomation.PCloud (≥ 10.0.0.7893924)
VMware.VimAutomation.Cloud (≥ 10.0.0.7893901)
VMware.DeployAutomation (≥ 6.5.2.7812840)
VMware.ImageBuilder (≥ 6.5.2.7812840)
VMware.VimAutomation.Storage (≥ 10.0.0.7894167)
VMware.VimAutomation.StorageUtility (≥ 1.2.0.0)
VMware.VumAutomation (≥ 6.5.1.7862888)

7. You cannot just run the command Import-Module VMware.VimAutomation.Core on clean system UNTIL you set your Execution Policy like so:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

8. Followed by:

Import-Module VMware.VimAutomation.Core

9. Followed by opting out of the Customer Experience Program with:

Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false

10. Before you make your first connect-viserver connection to your vCenter. You need to decide if you just going accept untrusted self-sign certificates that a generated during the install of VMware ESX and VMware vCenter – or whether you want go thru the ball-ache of issuing your own certificates. In a homelab environment your probably going just going to get rid of any warnings with:

Set-PowerCLIConfiguration -InvalidCertificateAction ignore -confirm:$false

There are two more steps left before you can use PowerCLI…

11. Firstly, wonder what became off PowerCLI 7, 8, and 9.

12. Wonder if this is actually progress… 🙂

13. But wait again. It is progress and here’s why. Once you have gone through all this hoop jumping updating the PowerCLI modules, doesn’t mean downloading yet an another package and in install. Up merely running an update from with the PowerCLI session likes so:

Update-Module -Name VMware.PowerCLI

In my case this updated the modules from 6.5 to 6.7 release of vSphere:

———- ——- —- —————-
Script 6.5.2.7… VMware.DeployAutomation {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-DeployRule…}
Script 6.5.2.7… VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProfile…}
Manifest 10.0.0…. VMware.PowerCLI
Script 10.0.0…. VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 10.0.0…. VMware.VimAutomation.Cloud {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog…}
Script 10.0.0…. VMware.VimAutomation.Common
Script 10.0.0…. VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 6.5.4.7… VMware.VimAutomation.HA Get-DrmInfo
Script 7.1.0.7… VMware.VimAutomation.HorizonView {Connect-HVServer, Disconnect-HVServer}
Script 10.0.0…. VMware.VimAutomation.License Get-LicenseDataManager
Script 10.0.0…. VMware.VimAutomation.Nsxt {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Script 10.0.0…. VMware.VimAutomation.PCloud {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInstance, Get-PIDatacenter}
Script 10.0.0…. VMware.VimAutomation.Sdk {Get-PSVersion, Get-InstallPath}
Script 10.0.0…. VMware.VimAutomation.Srm {Connect-SrmServer, Disconnect-SrmServer}
Script 10.0.0…. VMware.VimAutomation.Storage {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePolicy, Get-KeyManagementServer…}
Script 1.2.0.0 VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script 10.0.0…. VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitch…}
Script 10.0.0…. VMware.VimAutomation.Vmc {Connect-Vmc, Disconnect-Vmc, Get-VmcService, Connect-VmcServer…}
Script 10.0.0…. VMware.VimAutomation.vROps {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition…}
Script 6.5.1.7… VMware.VumAutomation {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance…}

Script 6.7.0.8… VMware.DeployAutomation {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-DeployRule…}
Script 6.5.2.7… VMware.DeployAutomation {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-DeployRule…}
Script 6.7.0.8… VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProfile…}
Script 6.5.2.7… VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-EsxImageProfile, Export-EsxImageProfile…}
Manifest 10.1.0…. VMware.PowerCLI
Manifest 10.0.0…. VMware.PowerCLI
Script 6.7.0.8… VMware.Vim
Script 10.1.0…. VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 10.0.0…. VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 10.0.0…. VMware.VimAutomation.Cloud {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, Get-Catalog…}
Script 10.1.0…. VMware.VimAutomation.Common
Script 10.0.0…. VMware.VimAutomation.Common
Script 10.1.0…. VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 10.0.0…. VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer…}
Script 6.5.4.7… VMware.VimAutomation.HA Get-DrmInfo
Script 7.1.0.7… VMware.VimAutomation.HorizonView {Connect-HVServer, Disconnect-HVServer}
Script 10.0.0…. VMware.VimAutomation.License Get-LicenseDataManager
Script 10.1.0…. VMware.VimAutomation.Nsxt {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Script 10.0.0…. VMware.VimAutomation.Nsxt {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Script 10.0.0…. VMware.VimAutomation.PCloud {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInstance, Get-PIDatacenter}
Script 10.1.0…. VMware.VimAutomation.Sdk
Script 10.0.0…. VMware.VimAutomation.Sdk {Get-PSVersion, Get-InstallPath}
Script 10.0.0…. VMware.VimAutomation.Srm {Connect-SrmServer, Disconnect-SrmServer}
Script 10.1.0…. VMware.VimAutomation.Storage {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePolicy, Get-KeyManagementServer…}
Script 10.0.0…. VMware.VimAutomation.Storage {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePolicy, Get-KeyManagementServer…}
Script 1.2.0.0 VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script 10.1.0…. VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitch…}
Script 10.0.0…. VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, Export-VDPortGroup, Export-VDSwitch…}
Script 10.0.0…. VMware.VimAutomation.Vmc {Connect-Vmc, Disconnect-Vmc, Get-VmcService, Connect-VmcServer…}
Script 10.0.0…. VMware.VimAutomation.vROps {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-OMAlertDefinition…}
Script 6.5.1.7… VMware.VumAutomation {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Compliance…}

If you wish to always open PowerCLI when you open PowersHell, you can create shortcut to it like so:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noe -c "Import-Module VMware.PowerCLI"

And finally, because PowerShell/PowerCLI is so chuffing great and functional, there’s even a GitHub edition of PowerShell for Linux and Mac (take that up the ass Perl and Bash!)

https://github.com/PowerShell/PowerShell/releases

 



Copyright 2018. All rights reserved.

Posted April 24, 2018 by Michelle Laverick in category "vSphere