Manually install a module from the PowerShell Gallery

Category: PowerShell

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

  1. Navigate to the PowerShell Gallery1. Search for the desired module
  2. Select the Manual Download tab
  3. Click the Download the raw nupkg file
  4. After the file finishes downloading, transfer it to the desired computer.

Install the module

  1. Rename the module replacing the .nupkg extension with a .zip

     Move-Item -Path .\sqlserver.21.1.18230.nupkg -Destination .\
  2. Extract the ZIP file. The resulting folder will have a name formatted like _._

     Expand-Archive -Path .\
  3. Determine where to install the module. For this example the module will be installed in $env:ProgramFiles

  4. Create a new folder in $Env:ProgramFiles\WindowsPowerShell\Modules with the name Module Name

     New-Item -Path $env:ProgramFiles\WindowsPowerShell\Modules\SqlServer -ItemType Directory
  5. Rename the module folder to be only the module version.

     Move-Item -Path .\sqlserver.21.1.18230 -Destination .\21.1.18230
  6. Move the module version folder into the module name folder.

     Move-Item -Path .\21.1.18230 -Destination $env:ProgramFiles\WindowsPowerShell\Modules\SqlServer
Written on December 11, 2020