level 3
白夜123456789
楼主
test.ps1
[System.Reflection.Assembly]::LoadFrom( ${env:windir} + "\system32\inetsrv\" + "Microsoft.Web.Management.dll" )
$infos = [Microsoft.Web.Management.Server.ManagementAuthorization]::GetAuthorizedUsers("NewWebSite1", $false, 0,[int]::MaxValue)
$keypress = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
test.ps1文件在ISE中运行成功,且在Powershell中通过 & ".\test.ps1"和 .\test.ps1可以运行成功。但是在powershell中尝试通过: powershell -file ".\test.ps1" 来执行命令时Powershell控制台停止工作(Stopped Working),在网上查资料后有尝试添加 -sta参数的,但是不起作用,请大神帮帮看看问题出在哪儿。
Powershell 版本: Version : 5.0.9897.0
2014年12月03日 07点12分
1
[System.Reflection.Assembly]::LoadFrom( ${env:windir} + "\system32\inetsrv\" + "Microsoft.Web.Management.dll" )
$infos = [Microsoft.Web.Management.Server.ManagementAuthorization]::GetAuthorizedUsers("NewWebSite1", $false, 0,[int]::MaxValue)
$keypress = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
test.ps1文件在ISE中运行成功,且在Powershell中通过 & ".\test.ps1"和 .\test.ps1可以运行成功。但是在powershell中尝试通过: powershell -file ".\test.ps1" 来执行命令时Powershell控制台停止工作(Stopped Working),在网上查资料后有尝试添加 -sta参数的,但是不起作用,请大神帮帮看看问题出在哪儿。
Powershell 版本: Version : 5.0.9897.0