Credit for this information should go to Kyle Ruddy’s post on the VMware Blogs platform. I have just packaged it up into a PowerShell script for ease of deployment.
Currently, this has been tested as of 6/11/2018, and is confirmed working on 64 bit Windows 10 builds 1709 and 1803 (which have PowerShell version 5). PowerCLI is running at 10.1.0 at the current date.
Below is a paste of the script hosted on this site. Feel free to either copy and paste or download from the site and execute.
Note: Be sure to read the disclaimer before running any of the commands or scripts below.
### Variable definitions$downloadsFolder = [Environment]::GetFolderPath("Desktop")
$psModulesFolder = [Environment]::GetFolderPath("mydocuments")
$powerCliExists = Test-Path -LiteralPath "C:\Program Files (x86)\VMware\Infrastructure\PowerCLI\"###### Check for old versions of PowerCLIIf ($powerCliExists-eq$False) {
Write-Host""Write-Host" No prior versions of PowerCLI detected " -ForegroundColor Black -BackgroundColor Green
Write-Host""
}
Else {
Write-Host""Write-Host" Please remove prior installs of PowerCLI before continuing. Re-run script when this is deleted. " -ForegroundColor Black -BackgroundColor Red
Write-Host""
Exit
}
###### Grab files for offline installNew-Item -ItemType directory -Path $downloadsFolder\PowerCLI-install >$nullWrite-Host""Write-Host"Respond with 'y' at the next step when prompted to allow downloading from NuGet. . ."Write-Host""
Save-Module -Name VMware.PowerCLI -Path $downloadsFolder\PowerCLI-install
###### Copy files to modules folderCopy-Item -Path "$downloadsFolder\PowerCLI-install\*" -Destination "$psModulesFolder\WindowsPowerShell\Modules" -Recurse -Force
###### CleanupRemove-Item -Path "$downloadsFolder\PowerCLI-install" -Recurse -Force
######Write-Host" Installation is complete! " -ForegroundColor Black -BackgroundColor Green
Write-Host" You may need to restart any programs to use the new modules. " -ForegroundColor Black -BackgroundColor Green
###
After this is done, wherever your computer’s Documents folder is (usually C:\Users\USERNAME\Documents), check for a new folder called WindowsPowerShell, and the Modules subfolder should contain some VMware.XXX folders, these should be the PowerCLI modules.
You’re now ready to rock with the latest version of PowerCLI!