Posted On January 30, 2023

How to Install PowerShell Module on An Offlined Computer

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> How to Install PowerShell Module on An Offlined Computer
# Download the desired module onto a 'jump host' (an intermediary computer that has access to the Internet)
PS C:\WINDOWS\system32> Save-Module -Name SqlServer -Path C:\Temp
PS C:\WINDOWS\system32> ls C:\temp
    Directory: C:\temp
Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         1/30/2023   5:04 PM                SqlServer

# Add files into remote computer from the jump host
robocopy c:\temp\sqlserver \\SERVERNAME\C$\Program Files\WindowsPowerShell\Modules /E /NP

PS C:\Windows\system32> Enter-PSSession SERVERNAME
[SERVERNAME]: PS C:\Users\kimconnect\Documents> Get-Module -Name SQLServer -ListAvailable
    Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     21.1.18256 SqlServer                           {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvail...

# Check SqlServer module's path
[SERVERNAME]: PS C:\Users\kimconnect\Documents> (Get-Module -ListAvailable SQLServer).path
C:\Program Files\WindowsPowerShell\Modules\SqlServer\21.1.18256\SqlServer.psd1

# Import sqlserver powershell module into current session
[SERVERNAME]: PS C:\Users\kimconnect\Documents> Import-Module -Name SqlServer

[SERVERNAME]: PS C:\Users\kimconnect\Documents> get-module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     21.1.18256 SqlServer                           {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvail...

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

On Premise Exchange to Office 365 Migration Using Method: Asynchronous PST Export & Import

Assumptions: 1. Hybrid Exchange Migration and Stage Migration methods have been considered and rejected2. Active…

Cisco Fabric Switch – MDS Zoning Template

<# What this script does: 1. Checks to see if an Internet connection via PowerShell…

PowerShell: Trigger Azure AD Sync on Remote Server as a Domain Admin

# Trigger-AD-Sync.ps1# Requirements: https://blog.kimconnect.com/powershell-install-rsat/## This script does these things:# a. Obtain Domain Admin credential# b.…
Other project: DragonCoin.com