Manually install a module from the PowerShell Gallery
There are instances where a computer does not have internet access and therefore cannot use the Install-Module
cmdlet to install modules from the PowerShell Gallery. This article will walk through how to manually download a module and install it on an offline computer.
Download a module
- Navigate to the PowerShell Gallery1. Search for the desired module
- Select the Manual Download tab
- Click the Download the raw nupkg file
- After the file finishes downloading, transfer it to the desired computer.
Install the module
-
Rename the module replacing the
.nupkg
extension with a.zip
Move-Item -Path .\sqlserver.21.1.18230.nupkg -Destination .\sqlserver.21.1.18230.zip
-
Extract the ZIP file. The resulting folder will have a name formatted like _
. _ Expand-Archive -Path .\sqlserver.21.1.18230.zip
-
Determine where to install the module. For this example the module will be installed in
$env:ProgramFiles
$env:PSModulePath.Split(';')
-
Create a new folder in
$Env:ProgramFiles\WindowsPowerShell\Modules
with the name Module NameNew-Item -Path $env:ProgramFiles\WindowsPowerShell\Modules\SqlServer -ItemType Directory
-
Rename the module folder to be only the module version.
Move-Item -Path .\sqlserver.21.1.18230 -Destination .\21.1.18230
-
Move the module version folder into the module name folder.
Move-Item -Path .\21.1.18230 -Destination $env:ProgramFiles\WindowsPowerShell\Modules\SqlServer