我在Windows Server 2012 R2上使用PowerShell 4.
调用来自此模块的Cmdlet时,特定模块WebAdministration不会自动加载.我试过的所有其他模块成功自动加载.我可以使用Import-Module手动加载此模块,它的行为符合预期.
PSModulePath =%SystemRoot%\ system32\WindowsPowerShell\v1.0\Modules \ WebAdministration Module Path = C:\ Windows\System32\WindowsPowerShell\v1.0\Modules\WebAdministration
简单测试输出
PS C:\ Users\Administrator> $ PSModuleAutoLoadingPreference ="All"
PS C:\ Users\Administrator> Get-WebBinding Get-WebBinding:术语"Get-WebBinding"未被识别为cmdlet,函数,脚本文件或可操作程序的名称.检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试.at line:1 char:1 + Get-WebBinding + ~~~~~~~~~~~~~~ + CategoryInfo:ObjectNotFound:(Get-WebBinding:String)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException
PS C:\ Users\Administrator> Import-Module WebAdministration
PS C:\ Users\Administrator> Get-WebBinding
protocol bindingInformation sslFlags -------- ------------------ -------- http*:8082:0 http*:8081:0
任何关于为什么自动加载不起作用的建议将不胜感激.谢谢!