1

我打算编写一个简单的别名“iis”来调用 IIS 管理器,即“C:\Windows\System32\inetsrv\InetMgr.exe”

set-alias iis "OpenIIS.ps1"

在 OpenIIS.ps1 我有

$item = "C:\Windows\system32\inetsrv\InetMgr.exe"
invoke-item -path $item

这行不通。我得到的错误是“系统找不到指定的文件”

实际上,仅在 inetsrv 上执行 Get-ChildItem 不会显示 InetMgr.exe(与 -Force 开关没有区别)

Get-ChildItem C:\Windows\system32\inetsrv\*.exe -force

伊姆古尔

显然我可以在资源管理器中看到它,我可以使用 cmd 启动它,但似乎不能使用 Powershell。此外,Powershell 以管理员身份运行。

到底是怎么回事?

作为一种解决方法,我尝试创建指向该文件的链接,然后从 Powershell 调用该链接。我现在得到一个“未指定”的 Win32Exception。

我最初使用 64 位 Powershell,但在 x86 Powershell 上得到相同的结果(均以管理员身份运行)

4

2 回答 2

0

您在提升的 PowerShell 提示符下吗?-Force除非您将参数与 Get-ChildItem 一起使用,否则某些系统文件可能不会显示。

于 2013-06-20T03:13:43.803 回答
0

我认为显然文件 InetMgr.exe 不存在,因为当我在上述目录中执行 get-childitem 时,它在那里列出了“InetMgr.exe”。

这可能不是 Get-ChildItem 或您创建的别名的问题,而是您的 IIS 服务器的问题。

于 2013-07-09T02:44:13.857 回答