PowerShell special module does not autoload

I am using PowerShell 4 on Windows Server 2012 R2.

A particular WebAdministration module does not load automatically when you invoke the cmdlet that comes from that module. All other modules that I tried to automatically download. I can load this module manually using Import-Module, and it behaves as expected.

  • The PSModulePath environment variable contains the module path. Other modules from this path automatically load.
  • The module is not ordinary. This is a built-in IIS feature. The function is on.
  • Startup enabled. $ PSModuleAutoLoadingPreference is All
  • Get-Command "Get-WebBinding" does not work, but Get-Command | where {$ _. Name -eq "Get-WebBinding"} does.
  • Get-Module -ListAvailable | where {$ _. Name -eq "WebAdministration"} returns the module with the correct path.

PSModulePath =% SystemRoot% \ system32 \ WindowsPowerShell \ v1.0 \ Modules \ Module path WebAdministration = C: \ Windows \ System32 \ WindowsPowerShell \ v1.0 \ Modules \ WebAdministration



Simple test result


PS C: \ Users \ Administrator> $ PSModuleAutoLoadingPreference = "All"

PS C:\Users\Administrator > Get-WebBinding Get-WebBinding: Get-WebBinding , , script . , , , . : 1 char: 1 + Get-WebBinding + ~~~~~~~~~~~~~~   + CategoryInfo: ObjectNotFound: (Get-WebBinding: String) [], CommandNotFoundException   + FullyQualifiedErrorId: CommandNotFoundException

PS C:\Users\Administrator > - WebAdministration

PS C:\Users\Administrator > Get-WebBinding

sslFlags -------- ------------------ -------- http:: 8082: 0 http *: 8081: 0




, . !

+5
1

, , .

, , , , .

Import-Module WebAdministration
Get-WebBinding

:

Import-Module WebAdministration; Get-WebBinding
0

Source: https://habr.com/ru/post/1621311/


All Articles