I have a script that works remotely with administrator rights,but I want it to work from a domain user who is in the group IIS_USERS , but this user is non-admin user withowt admin rights. UAC disable.
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" }}
produces such an error
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
user added to group IIS_USERS + IIS Manager Permission + Remote managment Users + WinRMRemoteWMIUsers. how to manage iis Non admin user with powershell?