Today topic is very short and it’s about how to install a Powershell module in offline mode
When do we need this ?
Let’s say you have a server in a secure zone or in the DMZ where there is no internet connectivity, how will you install the powershell module ?
In a corporate environment most of the servers are without internet, so offline installation of module is very helpful to run a desired command.
How to Download and save the module ?
Any module you want to install you can browse https://www.powershellgallery.com/ and find it.
Also you can find a module from powershell console itself using following command
After you find your module, save it to a custom folder path in local machine using following command
Verify that module is downloaded as shown below
How to Install?
Now copy the module folder to a temp location in the target server. Here I have copied to a server in the given path.
Here I have disabled both network interfaces just to show you that there is no connectivity in the server, still we will install and run the commands from AWSPowerhsell module.
In your case DO NOT disable any network adapter to perform this offline installation.
Now let’s verify that currently there is no module named AWSPowershell and there is no command we are seeing from the said module.
Now check what module paths are set in the env variable. I have following 3
You can copy to one of these locations according to your use. I have mentioned more about these locations below. Please refer before you copy the module.
$env:PSModulePath -split ";"
Modules are stored in this path when you provide the scope – CurrentUser while installing the module.
Modules are stored in this path when AllUsers Scope is provided.
It is the default path for the module. Whenever Microsoft updates any PowerShell version or module, it is installed on this location.
Here I have copied the AWSPowershell module to C:\Users\Jagat\Documents\WindowsPowerShell\Modules
Please see below.
Get-Module -Name AWSPowershell -ListAvailable
Now lets verify using following command
Get-Command -Module AWSPowerShell
Great! We can see the command from the AWSPowershell module. Here I have displayed first 10, you can remove the filter and see all of them
So that’s it for today, please try with some more modules and practice.
Will see you in my next blog post, till the bye and take care!!!