PowerCLI 12.0
Offline Install
Checking VMwares source wasn’t too insightful…
Just this with the “Download” button redirecting to an alternative site non-other than powershellgallery.com …clicking manual Download gives you the raw nuget package let’s try to install first normally.
Install-Module -Name VMware.PowerCLI
No way it failed, expected, and it even states a warning about the network.
Alright so using an online computer copy the nuget package to the offline (use USB sticks, Floppy drives, Zip Drives, serial modem if that’s what it takes…)
In my case I was testing this on a VM and simply used a USB stick to mount it to the VM from the VMRC console, and copied the nuget file to c:\temp\PowerCLI
This from this MS Doc page on the cmdlet, is for Visual Studio, we are using powershell only…
This topic describes the command within the Package Manager Console in Visual Studio on Windows. For the generic PowerShell Install-Package command, see the PowerShell PackageManagement reference.
Sure enough this is where I gave up on this path. All the new stuff is nice with it all being connected makes life super easy, but in those locked down situations this is a hassel. Since I wasn’t sure how to install the nuget package via a simple ID option like Install-Package for VS PS, there wasn’t one for the regular PS Install-Package cmdlet. Then I went to google how to accomplish this and was a bit annoyed at all the steps required to do it via the package manager… Read this by William on Stackoverflow for more details.
Lucky for me I found an alternative blog post, which does an alternative offline install and much, much simpler.
From the online system instead of saving the nuget package we save the modules files themselves directly.
Save-Module -Name VMware.PowerCLI -Path C:\temp\PSModules
Copy the entire contents of the PSModules folder to a storage medium of your choice (e.g. USB flash drive) and transfer the files to the desired offline system where PowerCLI is needed.
If you have admin rights on the target system, you can copy files to the location below.
C:\Program Files\WindowsPowerShell\Modules
At this point he goes on about some settings and stuff, I wasn’t exactly sure how to use PowerCLI, as usually it opens up in a custom PS window before. Now you simple import-module *modulename*
Import-Module VMware.PowerCLI
Now creating custom ESXi images should be a breeze!
Extra Bits
Customer Experience Improvement Program (CEIP)
The VMware Customer Experience Improvement Program collects data about the use of VMware products. You can either agree (true) or disagree (false). For offline systems, only the rejection (false) makes sense. The command shown below suppresses future notifications within PowerCLI.
Set-PowerCLIConfiguration -Scope AllUsers -ParticipateInCeip $false
Ignore invalid SSL certificates
When using self-signed certificates in vCenter, PowerCLI will deny the connection. This behavior can be suppressed with the command:
Set-PowerCLIConfiguration -Scope AllUsers -InvalidCertificateAction Warn
Found the types from this old 5.1 documentation you can also set it to ignore instead of warn. 🙂 Cheers!
Hey Aemilianus,
if I’m not mistaken executing the Import-Module Cmdlet is not required after copying over the files to the install directory.
I work in an environment where online updates are not possible and since there is no common repository for connected servers it’s a manual process I have written a document for. That basically just says:
1. Get the information from Path variables, that %PROGRAMFILES% folder is listed in Path variable.
2. Close all PowerShell windows
3. Extract the folders incl. files into the %PROGRAMFILES%\WindowsPowerShell\Modules directory
4. Start PowerShell window and execute the commands to ignore SSL warnings and disable CEIP.
Good day!
Thanks for commenting, maybe I had to do it cause I didn’t reload my PowerShell console after copying the files.
Just opened a new PowerShell and sure enough even after installing via online method, guess it’s not required. Still doesn’t hurt to know 😉