Reputation: 21
I wrote a powershell script to stop and start an IIS application pool on a windows server 2008 machine. IIS version is 7.5
I have administrator privileges on the machine and when I run it the script works fine. But when I trigger the same script with a Non-admin Service account it is failing.
The trigger is from CA Release Automation tool, the agent is configured on the machine with the service account. Following is the command where I am stuck.
gwmi -Namespace root\webAdministration -class ApplicationPool -Authentication PacketPrivacy | Where-Object { $_.Name -eq "siteURL" }
Error:
*****Get-WmiObject : Provider load failure At C:\Users\SVC_DEV_APP\AppData\Local\Temp\tempz_891958570065876740601304.ps1:2 char:5
+ gwmi <<<< -Namespace root\webAdministration -class ApplicationPool
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand Get-WmiObject : Provider load failure At C:\Users\SVC_DEV_APP\AppData\Local\Temp\tempz_891958570065876740601304.ps1:2 char:5
+ gwmi <<<< -Namespace root\webAdministration -class ApplicationPool + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand*****
I have tried getting a WMI object for other windows services(Win32_Service) and it works fine. Only for IIS objects it is throwing the error.
I have given the service account, control(Execute methods, Enable Account, Remote enable) over the namespace(in fact Root and its sub namespaces) as suggested in some forums.
I have also added the service account as IIS Manager, but nothing worked out.
Upvotes: 0
Views: 3529
Reputation: 1152
I think you are bumping into UAC. UAC unfortunately impacts WMI.
How to address it: https://msdn.microsoft.com/en-us/library/aa826699(v=vs.85).aspx
Upvotes: 0