Hi,
the powershell gallery offers a lot of modules for online installation. It’s also possible to download a nupkg file of that module and install it offline.
In this example I will install the powershell-yaml module
Firts of all download the nupkg package. The nupkg is a zip file.
1 2 | PS D:\temp> Invoke-WebRequest -UseBasicParsing -Uri https://psg-prod-eastus.azureedge.net/packages/powershell-yaml.0.4.2.nupkg -OutFile powershell-yaml.0.4.2.zipPS D:\temp> Expand-Archive powershell-yaml.0.4.2.zip -DestinationPath powershell-yaml |
Importend: The Destination Path must have the same basename as the *.psd1 and the *.psm1 within the expanded folder.
Then you can import the module by the path where the module is expanded to.
1 2 3 4 5 6 7 | PS D:\temp> Import-Module -Name D:\Temp\powershell-yamlPS D:\Temp> get-command -Module powershell-yamlCommandType Name Version Source----------- ---- ------- ------Function ConvertFrom-Yaml 0.4.2 powershell-yamlFunction ConvertTo-Yaml 0.4.2 powershell-yaml |
Or copy the folder powershell-yaml to one of the default module pathes where the powershell searches for modules when calling Import-Module.
1 2 3 4 5 | PS D:\temp> $ENV:PSModulePath.Split(";") C:\Program Files\WindowsPowerShell\ModulesC:\WINDOWS\system32\WindowsPowerShell\v1.0\ModulesPS D:\temp> Copy-Item -Recurse D:\temp\powershell-yaml "C:\Program Files\WindowsPowerShell\Modules" |
Michael