Web管理模块不公开其cmdlet

时间:2016-04-13 13:56:48

标签: powershell iis iis-7.5 powershell-v3.0 web-administration

鉴于MS Server 2008 r2,IIS 7.0升级到7.5 Powershell 2.0升级到3.0

执行命令import-module WebAdministration 它完成没有错误。 然后拨打get-command -module WebAdministration 它发现模块只暴露了两个命令:

  

CommandType名称
  ----------- ----
  Alias Begin-WebCommitDelay
  Alias End-WebCommitDelay

所以没有任何其他方法,例如Get-WebSite

为什么powershell看不到必须包含在WebAdministration中的所有可用cmdlet?

我有我的开发Win7机器,一切都很好。可以访问我需要的所有内容。

评论中建议的UPD为您提供了使用debug开关导入运行的输出:

PS C:\Windows\System32\WindowsPowerShell\v1.0> import-module WebAdministration -
Force -Debug
VERBOSE: Loading module from path
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\WebAdmini
stration.psd1'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):y
VERBOSE: Loading 'Assembly' from path
'C:\Windows\assembly\GAC_MSIL\Microsoft.IIS.PowerShell.Framework\7.5.0.0__31bf3
856ad364e35\Microsoft.IIS.PowerShell.Framework.dll'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Loading 'TypesToProcess' from path
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\iisprovid
er.types.ps1xml'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Loading 'FormatsToProcess' from path
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\iisprovid
er.format.ps1xml'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Loading module from path
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\Microsoft
.IIS.PowerShell.Provider.dll'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Loading module from path
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\WebAdmini
strationAliases.ps1'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Dot-sourcing the script file
'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\WebAdministration\WebAdmini
strationAliases.ps1'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Exporting alias 'Begin-WebCommitDelay'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Exporting alias 'End-WebCommitDelay'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Importing alias 'Begin-WebCommitDelay'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help
(default is "Y"):
VERBOSE: Importing alias 'End-WebCommitDelay'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help

UPD2:似乎与Powershell版本相关的问题,即3.0。当我使用-version 2运行PowerShell时,WebAdmininstration的cmdlet正常工作。但是为什么3.0错过了WebAdministration的命令,这就是问题。

0 个答案:

没有答案