简体   繁体   English

获取非管理员帐户的IIS应用程序池WMI对象

[英]Get IIS application pool WMI object for a Non-admin account

I wrote a powershell script to stop and start an IIS application pool on a windows server 2008 machine. 我编写了一个powershell脚本来停止和启动Windows Server 2008计算机上的IIS应用程序池。 IIS version is 7.5 IIS版本是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. 触发器来自CA Release Automation工具,该代理是使用服务帐户在计算机上配置的。 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 ***** Get-WmiObject:提供程序加载失败,位于C:\\ Users \\ SVC_DEV_APP \\ AppData \\ Local \\ Temp \\ tempz_891958570065876740601304.ps1:2 char:5
+ gwmi <<<< -Namespace root\\webAdministration -class ApplicationPool + gwmi <<<<-名称空间root \\ webAdministration -class ApplicationPool
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException + 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 + FullyQualifiedErrorId:GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand Get-WmiObject:提供程序加载失败,位于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 + gwmi <<<<-名称空间root \\ webAdministration -class ApplicationPool + CategoryInfo:InvalidOperation:(:) [Get-WmiObject],ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand***** + FullyQualifiedErrorId:GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand *****

I have tried getting a WMI object for other windows services(Win32_Service) and it works fine. 我尝试获取其他Windows服务(Win32_Service)的WMI对象,并且工作正常。 Only for IIS objects it is throwing the error. 仅对于IIS对象,它会引发错误。

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. 我已经在某些论坛中建议对名称空间(实际上是Root及其子名称空间)提供服务帐户,控制(执行方法,启用帐户,远程启用)权限。

I have also added the service account as IIS Manager, but nothing worked out. 我也已将服务帐户添加为IIS管理器,但没有任何结果。

I think you are bumping into UAC. 我认为您正在加入UAC。 UAC unfortunately impacts WMI. UAC不幸地影响了WMI。

How to address it: https://msdn.microsoft.com/en-us/library/aa826699(v=vs.85).aspx 如何解决: https//msdn.microsoft.com/en-us/library/aa826699(v = vs.85).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Powershell 在非管理员帐户上执行远程进程 - Execute a remote process on a non-admin account using Powershell IIS PowerShell应用程序池设置为“NetworkService”帐户 - IIS PowerShell Application Pool set as 'NetworkService' Account 以非管理员身份远程重启服务? - Restarting service remotely as non-admin? 从非管理上下文执行时 Get-CrmConnection 失败 (3.3.0.857) - Get-CrmConnection failing when executed from non-admin context (3.3.0.857) 如何以非管理员用户身份运行“Get-CimInstance”(windows server 2019,powershell 5.1) - How to run `Get-CimInstance` as non-admin user (windows server 2019, powershell 5.1) 如何从提升的 PowerShell 控制台以非管理员身份运行进程? - How to run a process as non-admin from an elevated PowerShell console? Powershell 脚本 - 仅以管理员身份运行某些命令,以非管理员身份运行脚本的 rest - Powershell Script - Run certain commands only as admin and rest of script as non-admin 当SCCM以管理员身份运行脚本并以非管理员身份登录时,$ ENV:USERNAME返回计算机名称 - $ENV:USERNAME returns the machine name when SCCM runs a script as admin with a non-admin logged in 如何从WMI对象引用中获取WMI对象? - How to get WMI object from a WMI object reference? 在非管理员用户下从远程运行PS cmdlet - 访问被拒绝 - Running PS cmdlets from remote under non-admin users - Access Denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM