使用powershell remote iis停止\启动应用程序池非管理员用户

时间:2017-10-11 08:17:54

标签: powershell iis remote-access remote-server winrm

我有一个远程管理员权限的脚本,但我希望它来自IIS_USERS组中的域用户,但该用户是非管理员用户,具有管理员权限。 UAC禁用。

Invoke-Command -ComputerName "test-tp" -ScriptBlock { Stop-WebAppPool -Name "Xml" }
$Path = "\\test-tp\bus\web.txt"
while (!(Test-Path $Path)) { Start-Sleep 10 }
If (Test-Path $Path) {Invoke-Command -ComputerName "test-tp" -ScriptBlock { Start-WebAppPool -Name "Bus" }}

产生这样的错误

Filename: redirection.config
Error: Cannot read configuration file due to insufficient permissions
    + CategoryInfo          : NotSpecified: (:) [Stop-WebItem], UnauthorizedAc
   cessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.IIs
   .PowerShell.Provider.StopItemCommand
    + PSComputerName        : test-tp

用户已添加到组IIS_USERS + IIS管理器权限+远程管理用户+ WinRMRemoteWMIUsers。 如何用powershell管理iis非管理员用户?

0 个答案:

没有答案