How to Install a PowerShell Module Offline from nupkg? (2024)

How to Install a PowerShell Module Offline from nupkg? (1)

PowerShell modules allow you to easily extend the capabilities of PowerShell by bundling together various cmdlets, functions, variables, etc., into a single package. Modules are incredibly useful for automating administrative tasks, scripting workflows, and boosting your productivity as a system administrator.

While most PowerShell modules are distributed via the online PowerShell Gallery repository, sometimes you may need to set up a module while working in an isolated offline environment with no internet connectivity. Offline PowerShell module installation comes up often when dealing with secured environments like government agencies or financial institutions.

In this comprehensive guide, we will explore step-by-step methods to install a PowerShell module in offline mode from a .nupkg file or extracted folder structure. Whether you are a beginner or an experienced PowerShell scripter, this guide aims to provide detailed instructions to suit all levels.

Table of contents

  • Prerequisites
  • Method 1 – Install a Module from .nupkg
    • Step 1: Download the .NUPKG package
    • Step 2: Create the trusted local repository (If it’s not created already)
    • Step 3: Transfer Module Packages
    • Step 4: Install the Module from the Local Folder
    • Updating and Removing Modules
  • Method 2 – Install Module Manually from Extracted Folder
    • Step 1: Download the Module to a computer with an Internet Connection
    • Step 2: Transfer the Modules to the Offline Computer
  • Conclusion

Prerequisites

Before diving into the offline installation process, let us first cover some prerequisites:

  • Access to a computer with an internet connection to download module packages
  • PowerShell 5.1 or later installed on both computers
  • USB/Network connectivity between source and destination computers to copy offline packages
  • Administrative access to install modules on the offline computer

Now that all prerequisites are met, let us move on to the actual offline installation process.

Method 1 – Install a Module from .nupkg

This method works for all PowerShell modules such as SharePoint Online, Azure AD, Active Directory, Exchange Online, Microsoft Teams, SQL server, PnP, etc. You need to first download the actual PowerShell module file onto the target offline system. Ensure the compressed .nupkg file is available on the target offline system where you wish to install the module. Copy it over to that system using a USB drive if needed.

The key steps to install nupkg in PowerShell:

  1. Find and download the module .nupkg packages from an online computer
  2. Transfer them to your offline computer via USB or network share
  3. Install the module with Install-Module to install each module from the local .nupkg files

Step 1: Download the .NUPKG package

The NuGet package format is most commonly used to distribute modules via repositories like the PowerShell Gallery.

  1. Open the PowerShell Gallery, https://www.powershellgallery.com, and search for the specific PowerShell module, such as SQL Server, Microsoft Teams, etc.
  2. Download the .nupkg file for the PowerShell module from the PowerShell Gallery.

Step 2: Create the trusted local repository (If it’s not created already)

As a next step, We need to register a local folder as a trusted repository. To get a list of existing trusted module repositories, type:

Get-PSRepository

This will get you the trusted repositories for your PowerShell environment.

Create a new folder for the local repository and register it. This is where you’ll be copying your Nupkg files.

Register-PSRepository -Name LocalPackages -SourceLocation C:\NuPkg -InstallationPolicy Trusted

Step 3: Transfer Module Packages

Once you have gathered all the necessary PowerShell module .nupkg files, you need to transfer them to your offline computer’s local repository you created/identified in the previous step. Copying files can be done using a USB drive or by copying them to a shared network location that the offline machine can access.

Step 4: Install the Module from the Local Folder

As a final step, install a module directly from a .nupkg file without any internet access:

  1. Start PowerShell with elevated user rights on the offline system (Run as Administrator)
  2. Navigate to the folder location containing the .nupkg file
  3. Run the Install-module cmdlet to install the module from the local .nupkg file:
Install-Module SQLServer -Scope AllUsers -Force

The cmdlet will install all module contents and dependencies on your local system, placing the module files appropriately:

You can also use the Install-Package cmdlet:

Install-Package -Name <ModuleName> -Source <repository-path> # For example:PS C:\>Install-Package -Name SQLServer -Source "C:\NuPkg"
  1. Confirm the installation: After installation, confirm import and functionality:
Get-Module SQLServerGet-Command -Module <ModuleName>

This approach provides an easy PowerShell-centric way to install modules without the internet if you already have the .nupkg file.

Updating and Removing Modules

To update or remove modules installed offline, download the updated packages to your offline computer and re-run the Install-Package command to install the newer version or the Uninstall-Package command to remove it.

Method 2 – Install Module Manually from Extracted Folder

Alternatively, if you have the module contents available with you as a zipped folder or extracted files layout, you can choose to install the PowerShell module manually.

In short, download the module from the PowerShell Gallery using an internet-connected computer and transfer the files to the offline machine using a secure method to the module directory.

Step 1: Download the Module to a computer with an Internet Connection

When we need to install PowerShell modules offline, it’s crucial that we initially find and download the correct versions along with their dependencies from an online source. Let’s examine how we can use Find-Module to locate these modules and Save-Module to download them for offline use.

Follow these steps for manual installation from extracted module folders:

  1. Start PowerShell with elevated rights on a system that has an internet connection
  2. Find the module from the PowerShell gallery
Find-Module -Name SQLServer
  1. Download the module to a specified folder, using the “Save-Module” cmdlet. In the example, I specified the destination as “C:\Temp”
Save-Module -Name SQLServer -Path "C:\Temp"

This will download all the exported cmdlets and functions to a subfolder in a specified directory.

How to Install a PowerShell Module Offline from nupkg? (7)

Step 2: Transfer the Modules to the Offline Computer

To begin with, it’s imperative to place the downloaded module into an appropriate directory recognized by PowerShell. Copy the downloaded Folder (in this case, “SQLServer” in “C:\Temp”) to the target computer’s Folder: “C:\Program Files\WindowsPowerShell\Modules“.

How to Install a PowerShell Module Offline from nupkg? (8)

Restart the PowerShell console, and you’ll be able to use the cmdlets of the particular module.

While manual installation takes more effort, it provides flexibility when you have a set of loose module folders. The folder structure can be recreated appropriately under the central module location.

In this article, you learned two different methods to install PowerShell modules in offline mode without internet connectivity. By using the Package Management tools or manually moving the module contents, you can now easily set up modules for isolated environments.

The key things to ensure are that you have the PowerShell module contents locally available as either a .nupkg file or extracted folders, the latest PowerShell version, and an appropriate script execution policy.

When working with systems that lack direct internet access, updating or installing PowerShell modules can be a challenge. As you can see, offline module deployment may need some additional effort, but it is quite achievable. This allows your automation scripts and tools to be made independent of internet connectivity constraints when working in secured environments.

So, next time you need to use that utility PowerShell module on an isolated network, don’t let the lack of internet access stop you! Just use one of these offline installation techniques to turbocharge your PowerShell scripts with powerful modules.

How can I install a PowerShell module on a machine without an internet connection?

To install a PowerShell module offline, you need to download the module from the PowerShell Gallery using an internet-connected computer, transfer the files to the offline machine using a secure method, and then use ‘Import-Module’ to install it on the target computer.

Why would I need to install PowerShell modules offline?

Offline installation is necessary in secure environments where computers cannot connect to the internet, on isolated networks, or in scenarios where security protocols prevent direct downloads from the PowerShell Gallery.

What are the prerequisites for offline installation of PowerShell modules?

You need a version of PowerShell 5.1 or newer, the PowerShellGet and PackageManagement tools, and administrative privileges on the computer where you will be installing the module.

What cmdlet can I use to download a PowerShell module for offline installation?

You can use the ‘Save-Module’ cmdlet to download the module you need from the PowerShell Gallery onto an internet-connected computer.

How should I transfer the downloaded PowerShell module to an offline computer?

Transfer the module using a secure method such as a USB drive or a secure network share, ensuring you follow best practices for file security and integrity.

How can I adjust the execution policy to allow offline PowerShell module installation?

Use the ‘Set-ExecutionPolicy’ cmdlet to change the execution policy settings, allowing for the installation and use of modules that have been downloaded off the internet.

How do I verify that a PowerShell module has been successfully installed offline?

Run ‘Get-Module -ListAvailable’ to list installed modules and try executing cmdlets from the module to ensure it is functioning correctly.

How do I install and import a PowerShell module on an offline machine?

With your PowerShell module copied to ‘C:\Program Files\WindowsPowerShell\Modules’, you could use ‘Import-Module -Name ModuleName’ to import the module into your PowerShell session. Replace ‘ModuleName’ with the actual name of the module’s folder.

Related Posts

How to Install a PowerShell Module Offline from nupkg? (2024)

FAQs

How to install PowerShell module from nupkg file? ›

The key steps to install nupkg in PowerShell:
  1. Find and download the module . nupkg packages from an online computer.
  2. Transfer them to your offline computer via USB or network share.
  3. Install the module with Install-Module to install each module from the local . nupkg files.
Jun 11, 2024

How to install NuGet package in PowerShell offline? ›

Copy the NuGet folder to an external media or find a way to get it onto your target system with no internet access. Copy the NuGet folder on your target computer under C:\Program Files\PackageManagement\ProviderAssemblies. Start a new PowerShell session on the target computer to auto-load the package provider.

How to install PowerShell SqlServer module offline? ›

Step-by-step guide without Internet
  1. Open a Powershell window on your system "as administrator"
  2. Check the Powershell version: $psversiontable.Psversion.
  3. Open a Powershell window on your system "as administrator"
  4. Extract the sqlserver.<version>.nupkg with a tool like 7zip into a folder called SqlServer.

How to install Azure AD PowerShell module offline? ›

Store the tar filename and destination filepath in variables. Download the tar archive from GitHub using PowerShell. Unblock the downloaded file if you're running a Windows operating system. Copy the tar archive to your offline system.

How to install a PowerShell module offline? ›

Download and save module to local folder path using Save-Module command. Now copy the downloaded module to C:\Program Files\WindowsPowerShell\Modules path. Offline installation is complete, now you can validate if this module is available. We can get list of available commands for installed modules.

How to download a PowerShell module manually? ›

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.
Dec 11, 2020

How to install NuGet package for PowerShell? ›

Installing NuGet PowerShell
  1. Install NuGet provider. Install the NuGet package provider by running the following command: Install-PackageProvider -Name NuGet -Force nuget. ...
  2. Install NuGet PowerShell Module. ...
  3. Install-Package. ...
  4. Get-Package. ...
  5. Uninstall-Package. ...
  6. Update-Package. ...
  7. Get-PackageSource.
May 9, 2023

How to install PowerCLI module in PowerShell offline? ›

In this case, perform an offline installation of the latest PowerCLI version.
  1. PowerShell. ...
  2. Install PowerCLI. ...
  3. Offline. ...
  4. Extract the downloaded .zip file to one of the listed folders. ...
  5. Verify if the PowerCLI module is available on your system. ...
  6. Explore Cmdlets. ...
  7. Update PowerCLI.

How to manually install a nupkg? ›

Install or update a package
  1. Open a command line and switch to the directory that contains your project file.
  2. Use the following command to install a NuGet package: dotnet add package <PACKAGE_NAME> ...
  3. After the command completes, you can open the project file to see the package reference.

How to install PowerShell module from local directory? ›

Method 2: Manually Install PowerShell Module
  1. Step 1: Determine the install Path. You want to install new modules in a path that is listed in the PSModulePath environment variable. ...
  2. Step 2: Copy the PowerShell model to Path. ...
  3. Step 3: Import the new PowerShell module.
Nov 28, 2022

How to import a PowerShell module? ›

To import the module into all sessions, add an Import-Module command to your PowerShell profile. To manage remote Windows computers that have PowerShell and PowerShell remoting enabled, create a PSSession on the remote computer and then use Get-Module -PSSession to get the PowerShell modules in the PSSession.

How to install Exchange Online PowerShell module manually? ›

Install Exchange Online PowerShell V3 module
  1. Set-ExecutionPolicy RemoteSigned.
  2. Install-Module PowershellGet -Force.
  3. Install-Module -Name ExchangeOnlineManagement -Force.
  4. Connect-ExchangeOnline -UserPrincipalName admin@exoip. ...
  5. Connect-ExchangeOnline -UserPrincipalName admin@exoip. ...
  6. Disconnect-ExchangeOnline -Confirm:$false.
Dec 12, 2023

How do I install Active Directory PowerShell module only? ›

Use Install-Module cmdlet: Execute the following command to install the Active Directory PowerShell Module: Install-Module -Name RSAT-AD-PowerShell. Confirm installation: Once the installation is complete, you may need to confirm that you want to install the module by typing 'Y' and pressing Enter.

How do I install MS online PowerShell module? ›

To install the MSOnline module, launch PowerShell 64 bit in administrative mode and run the following command:
  1. Install-Module MSOnline.
  2. Install-PackageProvider NuGet.
  3. $currentPrincipal = New-Object Security. ...
  4. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process.

How to install all AZ modules in PowerShell? ›

Installation and update
  1. Visit github.com/Azure/azure-powershell/releases.
  2. Locate the most recent Az PowerShell module. ...
  3. Scroll down to the end of the patch notes and click the arrow next to "Assets" to reveal the MSI options.
  4. Click on the Az-Cmdlets MSI of your choice to start the download.
Sep 3, 2024

How to install NuGet package in PowerShell? ›

Installing NuGet PowerShell
  1. Install NuGet provider. Install the NuGet package provider by running the following command: Install-PackageProvider -Name NuGet -Force nuget. ...
  2. Install NuGet PowerShell Module. ...
  3. Install-Package. ...
  4. Get-Package. ...
  5. Uninstall-Package. ...
  6. Update-Package. ...
  7. Get-PackageSource.
May 9, 2023

How do I import a PowerShell module? ›

To import the module into every new session, add an Import-Module command to your PowerShell profile. For more information about profiles, see about_Profiles. You can manage remote Windows computers that have PowerShell remoting enabled by creating a PSSession on the remote computer.

Top Articles
How to Research Penny Stocks When Trading
Airbnbs in Ireland – Travel Curator
Funny Roblox Id Codes 2023
Login Page
Mackenzie Rosman Leaked
Women's Beauty Parlour Near Me
Toyota gebraucht kaufen in tacoma_ - AutoScout24
Apply A Mudpack Crossword
Magic Mike's Last Dance Showtimes Near Marcus Cedar Creek Cinema
Mikayla Campinos Videos: A Deep Dive Into The Rising Star
Pvschools Infinite Campus
Simon Montefiore artikelen kopen? Alle artikelen online
Maplestar Kemono
Panorama Charter Portal
Aucklanders brace for gales, hail, cold temperatures, possible blackouts; snow falls in Chch
Rachel Griffin Bikini
Icommerce Agent
1773X To
bode - Bode frequency response of dynamic system
FDA Approves Arcutis’ ZORYVE® (roflumilast) Topical Foam, 0.3% for the Treatment of Seborrheic Dermatitis in Individuals Aged 9 Years and Older - Arcutis Biotherapeutics
Tips on How to Make Dutch Friends & Cultural Norms
Qual o significado log out?
Isaidup
Theater X Orange Heights Florida
Wemod Vampire Survivors
Www Craigslist Madison Wi
Kirk Franklin Mother Debra Jones Age
Villano Antillano Desnuda
'Insidious: The Red Door': Release Date, Cast, Trailer, and What to Expect
Bayard Martensen
Gncc Live Timing And Scoring
Devotion Showtimes Near The Grand 16 - Pier Park
Kristen Hanby Sister Name
Newsday Brains Only
Wbli Playlist
Joplin Pets Craigslist
آدرس جدید بند موویز
19 Best Seafood Restaurants in San Antonio - The Texas Tasty
Temu Y2K
One Main Branch Locator
Mixer grinder buying guide: Everything you need to know before choosing between a traditional and bullet mixer grinder
Linda Sublette Actress
Gfs Ordering Online
Sdn Fertitta 2024
The power of the NFL, its data, and the shift to CTV
Advance Auto.parts Near Me
Blue Beetle Showtimes Near Regal Evergreen Parkway & Rpx
All Weapon Perks and Status Effects - Conan Exiles | Game...
What is 'Breaking Bad' star Aaron Paul's Net Worth?
Cch Staffnet
Food and Water Safety During Power Outages and Floods
18443168434
Latest Posts
Article information

Author: Trent Wehner

Last Updated:

Views: 6757

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Trent Wehner

Birthday: 1993-03-14

Address: 872 Kevin Squares, New Codyville, AK 01785-0416

Phone: +18698800304764

Job: Senior Farming Developer

Hobby: Paintball, Calligraphy, Hunting, Flying disc, Lapidary, Rafting, Inline skating

Introduction: My name is Trent Wehner, I am a talented, brainy, zealous, light, funny, gleaming, attractive person who loves writing and wants to share my knowledge and understanding with you.