Create PowerCLI profile and setup powercli without Install on Windows Server or PC

This is a quick blog post of creating a PowerCLI or PowerShell profile and having powercli modules or commands available using native windows PowerShell without installing powercli or having native admin privileges on a windows server or desktop pc.

Install PowerCLI Offline

You can install all VMware PowerCLI modules in offline mode by using a ZIP file.​​ Download Zip File from link here​​ 

You might need to install PowerCLI on a local machine with no Internet connectivity due to security reasons and deployment restrictions. If you are using such an environment, you can download the PowerCLI ZIP file on a computer with Internet access, transfer the ZIP file to your local machine and install PowerCLI.

Prerequisites

  • Verify that your system is compatible with PowerCLI. See the Compatibility Matrix on the PowerCLI home page.

  • Verify that PowerShell is available on your system. For Linux and macOS, you must install PowerShell. See how to install PowerShell on different platforms.

  • For Windows, if you have PowerCLI 6.5 R1 or earlier, uninstall it.

  • Download the PowerCLI ZIP file from the PowerCLI home page and transfer the ZIP file to your local machine.

Procedure

  • Open PowerShell on your local machine.

  • Create profile using below if not already there

Test-Path​​ $profile

New-Item​​ -path​​ $profile​​ -type​​ file​​ –force

 

 

Once created open the profile and add below line to ignore invaliud cert in vcenter connection​​ 

 

Import-Module​​ VMware.VimAutomation.Core

Set-PowerCLIConfiguration​​ -InvalidCertificateAction​​ Ignore​​ -Confirm:$false​​ 

 

  • To view the folder paths to which you can extract the PowerCLI ZIP file, run the command:$env:PSModulePath

  • Extract the contents of the PowerCLI ZIP file to one of the listed folders.

 

 

Copy and paste the content of the zip file to the modules folder as per below

 

  • For Windows, run the command to unblock the copied files.Get-ChildItem -Path​​ 'folder_path' -Recurse​​ | Unblock-FileReplace folder_path with the path to the folder where you extracted the contents of the ZIP file.

  • (Optional) Verify that the VMware PowerCLI modules have installed successfully.Get-Module VMware* -ListAvailable

Results

You can now run PowerCLI on your local machine.

 

 

If you have admin persmission and access to internet, you can run below command in admin mode to install PowerCLI

## To install individual module
Install-Module VMware.VimAutomation.Core -AllowClobber 
## To install all modules 
Install-Module VMware.PowerCLI 

You May Also Like

About the Author: VirtuallyThatGuy

Leave a Reply

Your email address will not be published. Required fields are marked *