Installing PowerShell Modules Offline Using .nupkg Files
Sometimes you can’t use Save-Module
directly but still want to install modules offline. In this case, you can download the NuGet package (.nupkg) files from the PowerShell Gallery.and install them manually.
Step 1: Find and Download the .nupkg
File
-
Go to PowerShell Gallery
-
Search for your module (e.g.,
NetApp.ONTAP
,Pester
,PSReadLine
). -
On the module’s page, select the desired version.
-
Click the Download Package link — this will download a
.nupkg
file.
Example: NetApp.ONTAP.10.3.1.nupkg
Step 2: Extract the .nupkg
File
A .nupkg
file is just a ZIP archive. You can rename it and extract it.
Inside the extracted folder, you’ll find the module content under the tools
folder.
Step 3: Copy Module to PowerShell Module Path
Locate the folder inside tools\
that contains the module files (e.g., NetApp.ONTAP
).
Copy that folder to one of the PowerShell module paths:
Windows PowerShell:- C:\Users\<username>\Documents\WindowsPowerShell\Modules
- C:\Program Files\WindowsPowerShell\Modules
- C:\Program Files\PowerShell\7\Modules
- C:\Users\<username>\Documents\PowerShell\Modules
Example:
Step 4: Import and Verify the Module
Load the module and confirm it’s installed:
You should now see the module available in your offline machine.
Notes
- Some modules have dependencies. You’ll need to repeat the same steps for each required module (listed on the module’s Gallery page).
- For repeatable installs, consider storing the
.nupkg
files on a network share or setting up an internal NuGet repository.
Post a Comment