How to Install a PowerShell Module Offline (.nupkg)

To install a PowerShell module offline, download it on a PC with internet, copy the folder to the offline machine, and put it in a module path:

Save-Module -Name Microsoft.PowerShell.SecretStore -Path E:\OfflineModules -Repository PSGallery -Force

Save-Module grabs the module and its dependencies. On the offline side, copy each folder into your Modules folder, or install the .nupkg files from a local repository.

Tom Baker runs IT for a Denver credit union. Its vault server has no internet, and he needs the SecretStore module on it. We’ll build his whole kit, step by step, and test each path in PowerShell 7 and 5.1.

What the Finished Offline Install Looks Like

Tom ends up with a USB folder holding two modules: Microsoft.PowerShell.SecretStore 1.0.6 and the Microsoft.PowerShell.SecretManagement 1.1.2 module it needs. The offline server gets them three ways: a plain copy, a local repository, or a manual .nupkg install.

I ran the online steps on my PC, then installed only from local folders, as if the network were gone. Everything went to the CurrentUser scope, so no admin rights. If Install-Module itself is missing, see the Install-Module is not recognized fix first.

Step 1: List the Module’s Dependencies

An offline server can’t fetch a missing dependency later, so check what the module needs before you leave the online PC:

Find-Module -Name Microsoft.PowerShell.SecretStore -Repository PSGallery -IncludeDependencies |
    Format-Table Name, Version, Repository

Output:

Name                                  Version Repository
----                                  ------- ----------
Microsoft.PowerShell.SecretStore      1.0.6   PSGallery
Microsoft.PowerShell.SecretManagement 1.1.2   PSGallery

SecretStore needs SecretManagement, because its manifest lists it under RequiredModules. Both shells printed the same two rows.

Copy both, or the module won’t load. Creating a PowerShell module explains manifests.

Step 2: Download the Module With Save-Module

On the online PC, Save-Module downloads the module and every dependency without installing them. -Force creates the target folder if it doesn’t exist:

Save-Module -Name Microsoft.PowerShell.SecretStore -Repository PSGallery -Path .\OfflineModules -Force

Get-ChildItem -Path .\OfflineModules -Directory | ForEach-Object {
    '{0}\{1}' -f $_.Name, (Get-ChildItem -Path $_.FullName -Directory).Name
}
$size = (Get-ChildItem -Path .\OfflineModules -Recurse -File | Measure-Object -Property Length -Sum).Sum
'Total: {0:N0} KB' -f ($size / 1KB)

Output:

Microsoft.PowerShell.SecretManagement\1.1.2
Microsoft.PowerShell.SecretStore\1.0.6
Total: 553 KB
Save-Module downloading SecretStore and SecretManagement to a local folder in PowerShell 7
One comma