How to Install PowerShell Modules Offline
Sometimes you need to install a PowerShell module on a machine that doesn’t have internet access—maybe due to strict firewall rules, isolated networks, or security policies. In these cases, you can perform an offline installation of the PowerShell module. This guide will walk you through the process step by step.
Why Offline Installations?
- Air-gapped environments – Systems disconnected from the internet for security reasons.
- Corporate restrictions – Firewalls or proxies blocking the PowerShell Gallery.
- Repeatable deployments – Ensuring consistent versions across multiple servers without always reaching out to the internet.
Step 1: Identify the Module and Version
On a machine with internet access, decide which module and version you need. For example, let’s say we want to install the NetApp.ONTAP
module.
Step 2: Download the Module to a Local Folder
Use the Save-Module
cmdlet to download the module files:
This command will fetch the module and place it inside C:\PSModules\NetApp.ONTAP
.
Step 3: Transfer the Module to the Offline Machine
Use USB, secure copy (SCP), or another method to move the downloaded module folder from the internet-connected machine to your offline environment. Place it in one of the recognized PowerShell module paths.
Common default paths are:
- All users:
C:\Program Files\WindowsPowerShell\Modules
- Current user only:
C:\Users\<username>\Documents\WindowsPowerShell\Modules
For PowerShell 7 (Core):
- All users:
C:\Program Files\PowerShell\7\Modules
- Current user:
C:\Users\<username>\Documents\PowerShell\Modules
Step 4: Import and Verify the Module
Once copied, load the module into your session:
Verify it’s available:
If you see the module listed, the offline installation was successful.
Step 5 (Optional): Register a Custom Local Repository
If you frequently need to install modules offline, you can set up your own internal repository (using a network share or an internal NuGet server).
Example with a simple network share:
This makes the offline process much easier across multiple machines.
Post a Comment