1

给定 MS Server 2008 r2,IIS 7.0 升级到 7.5 Powershell 2.0 升级到 3.0

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

CommandType 名称
----------- ----
别名 Begin-WebCommitDelay
别名 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 2WebAdmininstration 的 cmdlet 运行 powershell 时,它可以正常工作。但是为什么 3.0 错过了 WebAdministration 的命令,这是个问题。

4

0 回答 0