简体   繁体   English

如何以非管理员用户身份运行“Get-CimInstance”(windows server 2019,powershell 5.1)

[英]How to run `Get-CimInstance` as non-admin user (windows server 2019, powershell 5.1)

I am trying to run a powershell command on a server very similar to this one.我正在尝试在与此非常相似的服务器上运行 powershell 命令。

https://stackoverflow.com/a/55942155/4577279 https://stackoverflow.com/a/55942155/4577279

The problem is that the script is being run by a non-admin user, and it fails to run the Get-CimInstance command.问题是脚本由非管理员用户运行,并且无法运行Get-CimInstance命令。

it fails with它失败了

Get-CimInstance : Access denied 
At C:\bin\SCRIPT.ps1:6 char:5
+     Get-CimInstance Win32_Process | ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (root\cimv2:Win32_Process:String) [Get-CimInstance], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand


The command is run by an instance of windows server 2019 on a remote box.该命令由远程框上的 Windows Server 2019 实例运行。 The script in question is on the box as well.有问题的脚本也在盒子上。

How can I allow for the non-admin user to run this command without having to run it as administrator?如何允许非管理员用户运行此命令而不必以管理员身份运行它? I am in full control of the server and can modify the permissions, but I'm not sure how to approach that.我完全控制服务器并且可以修改权限,但我不确定如何处理。 The script should be run by a non-admin if at all possible.如果可能,脚本应该由非管理员运行。

alternatively if there is a different way to get the entire children process tree for a given PID, that could work, too.或者,如果有一种不同的方法来获取给定 PID 的整个子进程树,那也可以。

Thank you谢谢

By default, Administrators (local) and Authenticated Users (domain) have at least read rights to the namespace.默认情况下, Administrators (本地)和经过Authenticated Users (域)至少具有对命名空间的读取权限。 You need to ensure you can login/authenticate to the server.您需要确保您可以登录/验证服务器。 It's worth mentioning that the Authenticated Users group does not have Remote Enable permission by default.值得一提的是, Authenticated Users组默认没有Remote Enable权限。 see this answer for more information - What are the permissions required for CIMSessions有关更多信息,请参阅此答案 - CIMSessions 需要哪些权限

暂无
暂无

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

相关问题 用于Powershell 2.0的get-CimInstance - get-CimInstance for powershell 2.0 如何从提升的 PowerShell 控制台以非管理员身份运行进程? - How to run a process as non-admin from an elevated PowerShell console? cordova 安装错误 - 命令失败:powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption 术语“Get-CimInstance”不是重新 - cordova installation error -Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption The term 'Get-CimInstance' is not re 在 Powershell 中,如何正确使用 Get-CimInstance 来检索各个计算机的 IPV6 地址? - In Powershell, how can I correctly use Get-CimInstance to retrieve the IPV6 addresses of respective computers? Get-CimInstance在Powershell中列出我计算机上的打印机 - Get-CimInstance to list out printers on my computer in powershell powershell 函数在没有 Get-CimInstance 的情况下杀死 *nix 上的子进程 - powershell function to kill child processes on *nix without Get-CimInstance 如何使用 Get-CimInstance 获取处理器“SocketDesignation”? - How can I get the processor "SocketDesignation" with Get-CimInstance? Get-CimInstance重复输出多次 - Get-CimInstance repeats output multiple times Powershell 6.2和Get-CimInstance远程停止/启动/重新启动服务问题 - Powershell 6.2 and Get-CimInstance to remotely stop/start/restart service issues Get-CimInstance win32_networkadapterconfiguration 以在 powershell 中返回 MAC 和 IP 地址 - Get-CimInstance win32_networkadapterconfiguration to return MAC and IP adress in powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM