In this post I will show you how to install the PowerShell module offline. There could be a situation on a system which doesn’t have internet connectivity or you don’t have administrative privileges to install the PowerShell Module. Installing the PowerShell module offline will be your only option left to get the module installed manually.
Find the current path of PowerShell Module directory
Our first step would be to find the current directory set for PowerShell module. This can be easily verified by running the following PowerShell command:
$env:PSModulePath -split ';'
Two prominent path for PowerShell module is:
The first location is the default location for user initiated downloading of PowerShell Module.
If internet was working, we could have run the following command to download the PowerShell Module directly from internet:
Install-Module -Name Microsoft.Graph.Intune
But as this blog is about installing the PowerShell Module without having internet connection, we will be first downloading the module and saving it to one of the above-mentioned default path.
Download the PowerShell Module
Let’s find the module first. Run the following command to find the module:
Find-Module -Name *Microsoft*intune*
Make sure you are running the command on a system which already have internet connection.
Once we are able to find the module, run the following command to download and save the module to specific location.
Save-Module -Name Microsoft.Graph.Intune -Path c:\temp
We can see the PowerShell Module is downloaded at c:\temp location.
Copy the PowerShell Module to PSModule path
We can copy this source to another device now which could be laptop, desktop or server.
We have the PowerShell module downloaded. Copy c:\temp\Microsoft.Graph.Intune (from source device) to C:\Program Files\WindowsPowerShell\Modules (destination device)
We can now run following command to load the module in current session:
Import-Module -Name Microsoft.Graph.Intune
We can now see the commands we can use for this specific module by running:
Get-Command -Module Microsoft.Graph.Intune
Installing offline PowerShell Module is a straightforward process where we need to download the Module on a device with internet connection. Once downloaded, we can copy/paste it to destination device under specific location where PowerShell modules are saved.