简体   繁体   English

如何使用与WMI范围不同的凭据通过WMI在远程计算机上运行程序

[英]How to run program on remote computer via WMI using credentials that are differ from WMI scope

I would like to run program using Win32_Process Create method, credential that I supply to Wmi connection is admin credentials, but program should be running under another credentials (non-admin, no access to WMI) 我想使用Win32_Process Create方法运行程序,我提供给Wmi连接的凭据是管理员凭据,但是程序应该在另一个凭据下运行(非管理员,无法访问WMI)

The only solution that I come up with is to run small program on computer that will impersonate to weaker user and will do the job, I think there should be the better way. 我想出的唯一解决方案是在计算机上运行小程序,该程序会冒充较弱的用户并能胜任工作,我认为应该有更好的方法。

Providing your logged on as admin, it shouldn't matter. 提供您以管理员身份登录,没关系。

Example: 例:

C:\>wmic process call create "cmd /c tasklist | sort & pause"
Executing (Win32_Process)->Create()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ProcessId = 5240;
        ReturnValue = 0;
};

Just make sure the command you execute is valid: 只要确保您执行的命令是有效的:

C:\>wmic process call create /?
Call                    [ In/Out ]Params&type                   Status
====                    =====================                   ======
Create                  [IN ]CommandLine(string)                Implemented

                        [IN ]CurrentDirectory(string)

                        [IN ]ProcessStartupInformation(object:Win32_ProcessStartup)

                        [OUT]ProcessId(uint32)

                        [OUT]ReturnValue(uint32)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM