How To Install PowerShell Modules In Offline Mode

Introduction

In this blog, we will learn to manually install PowerShell modules. Recently, I was working on VM desktop with restricted access to perform PowerShell tasks, no direct internet access, and PSRepository access for installing modules. If you do not have any restrictions, we can install PowerShell modules from the official PowerShell gallery repository using the command "Install-Module".

Note
There is no direct repository to download modules from the official PowerShell gallery. You can download only NuGet(a .nupkg file) package from the official site to install the module, but this will not be the complete module installation.

Prerequisites

  • PowerShell version 5.1 or newer

Below are the steps to manually installing PowerShell modules,

Step 1

To ensure that the module exists, launch PowerShell and search for it in the PowerShell Gallery. 

Find-Module -Name “module name”

How to install PowerShell modules in offline mode

Step 2

Download and save module to local folder path using Save-Module command.

Save-Module –Name “module name” –Path “local folder path”

How to install PowerShell modules in offline mode

Downloaded module to the specified location:

How to install PowerShell modules in offline mode

Step 3

Now copy the downloaded module to C:\Program Files\WindowsPowerShell\Modules path.

How to install PowerShell modules in offline mode

Step 4

Offline installation is complete, now you can validate if this module is available.

Get-Module -ListAvailable “module name”

How to install PowerShell modules in offline mode

Step 5

We can get list of available commands for installed modules.

Get-Command -Module “module name”

How to install PowerShell modules in offline mode

Conclusion

In this blog, we learned how to manually install PowerShell modules in offline mode when you have restricted access to a computer or are working on an isolated network with no direct access to the internet.