Module in powershell

https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-6

https://docs.microsoft.com/en-us/powershell/developer/module/understanding-a-windows-powershell-module

Get-Module

https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Core/Get-Module?view=powershell-6

~Desktop> Get-Module

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 6.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty...}
Manifest 6.1.0.0 Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script 1.0.0.0 posh-git {Add-PoshGitToProfile, Expand-GitCommand, Format-GitBranchName, Get-GitBranchStatusColor...}
Script 2.0.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}

Find-Module

https://docs.microsoft.com/en-us/powershell/module/PowerShellGet/Find-Module?view=powershell-6

Finds modules from an online gallery that match specified criteria.

Install-Module

https://docs.microsoft.com/en-us/powershell/module/PowerShellGet/Install-Module?view=powershell-6

Downloads one or more modules from an online gallery, and installs them on the local computer.

需要显式指定代理

Install-Module -Name WindowsCompatibility -Proxy "http://domain:port"

 Import-Module

 https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Core/Import-Module?view=powershell-6

Adds modules to the current session.

The Import-Module cmdlet adds one or more modules to the current session.

The modules that you import must be installed on the local computer or a remote computer.

Import-Module imports a module only into the current session.

To import the module into all sessions, add an Import-Module command to your PowerShell profile.

For more information about profiles, see about_Profiles.

Update-Module

  Update-Module -Name PowerShellGet -Proxy "http://domain:port" -Verbose -MaximumVersion 2.1.2 -Force

$PROFILE  

C:UserscluDocumentsPowerShellMicrosoft.PowerShell_profile.ps1

文件内容

Import-Module 'C:Usersclusource eposGitHubOtherposh-gitsrcposh-git.psd1'
Import-Module 'C:Usersclusource eposGitHubOtherPowerShelluild.psm1'

原文地址:https://www.cnblogs.com/chucklu/p/9596498.html