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

PowerShell: Use EMCOPY to Mirror a Directory

# Purpose: this PowerShell snippet is to demonstrate the use of Emcopy$source="C:\Users\tester\Desktop\Clients"$destination="C:\Users\tester\Desktop\Test"#$switches="/o /secforce /s /de…

PowerShell: List Biggest Files and Folders on a Volume

# listBigFilesAndFolders-v0.01.ps1 # Set variables $parentDirectory="C:\" $depth=4 $topX=10 $excludeDirectories="C:\Windows","C:\Program Files","C:\Program Files (x86)" $clusterSizeOfNetworkShare=8192 # Sanitize…

Installing DotNet 3.5 on Windows with Restricted Internet Access

# Set Windows Source files # Assuming that a Windows ISO / DVD Rom have…
Other project: DragonCoin.com