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

  1. Go to PowerShell Gallery

  2. Search for your module (e.g., NetApp.ONTAP, Pester, PSReadLine).

  3. On the module’s page, select the desired version.

  4. 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.

# Rename file (optional, makes extraction easier) Rename-Item NetApp.ONTAP.10.3.1.nupkg NetApp.ONTAP.10.3.1.zip # Extract contents to a folder Expand-Archive -Path .\NetApp.ONTAP.10.3.1.zip -DestinationPath C:\Temp\NetApp.ONTAP

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
PowerShell 7:
  • C:\Program Files\PowerShell\7\Modules
  • C:\Users\<username>\Documents\PowerShell\Modules

Example:

Copy-Item -Path "C:\Temp\NetApp.ONTAP\tools\NetApp.ONTAP" -Destination "C:\Program Files\PowerShell\7\Modules" -Recurse

Step 4: Import and Verify the Module

Load the module and confirm it’s installed:

Import-Module NetApp.ONTAP Get-Module -ListAvailable NetApp.ONTAP

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.

No comments

Theme images by chuwy. Powered by Blogger.