简体   繁体   English

WMIC流程调用开始无法远程运行

[英]WMIC process call start not working remotely

Here's the info: Currently we're working on how to execute a batch file on another server, but since we're on research and testing phase we're currently working on our client PC. 这是信息:目前,我们正在研究如何在另一台服务器上执行批处理文件,但是由于我们处于研究和测试阶段,因此目前正在客户端PC上进行工作。 I tried to run using this command: 我试图使用以下命令运行:

wmic /user:<username> /password:<password> /node:<machine_name> process call create "cmd /c E:\sharedfolder\try_wmic.bat"

Is it necessary to work on this by an administrator account, or did I miss something? 是否有必要通过管理员帐户进行此操作,还是我错过了某些事情?

Thanks and I appreciate all your feedback :) 谢谢,我感谢您的所有反馈意见:)

wmic created processes start with no network privileges. Wmic创建的进程开始时没有网络特权。 Even attempting to use UNC network paths can fail if you are accessing a Windows 10 machine. 如果您正在访问Windows 10计算机,则即使尝试使用UNC网络路径也可能失败。 Something like the following will work: 类似于以下内容的方法将起作用:

wmic /node:"computername" process call create "cmd.exe /c (net use /user:\"DOMAIN\AdminUser\" x: \\machine\share \"YourPassword\" && dir x:\ && net use x: /delete ) > c:\test.txt"

With the obvious caveat that you are passing credentials in plain text. 显而易见的警告是,您正在以纯文本格式传递凭据。

The issue is that in order to create a process on another machine you need elevated privileges, and with elevated privileges your normal network mappings are no longer available. 问题是,为了在另一台计算机上创建进程,您需要提升的特权,而使用提升的特权,您的常规网络映射将不再可用。 It is as though there are two different admin users: one when the admin user is doing normal things and another when the admin user invokes those privileges (for instance to create a process on another machine). 好像有两种不同的admin用户:一种是当admin用户正在执行正常操作时,另一种是当admin用户调用这些特权(例如,在另一台计算机上创建进程)时。

As an example of the issue, if you did not remove the drive mapping to X: as I did in my example and targeted a Windows 10 machine with that command, a normal user might see the mapping, but would be unable to use it: 'net use' would show the drive was 'Unavailable' and attempting to access it would result in 'The system cannot find the path specified'. 作为问题的一个示例,如果您没有像我在示例中那样删除驱动器到X:的映射,并使用该命令将Windows 10计算机作为目标,则普通用户可能会看到该映射,但将无法使用它: “网络使用”将显示驱动器“不可用”,尝试访问该驱动器将导致“系统找不到指定的路径”。

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

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