热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

WMIWin32_Process.Create失败,权限不足-WMIWin32_Process.CreatefailswithInsufficientPrivs

ImtryingtorunasimplecmdutilityonaremoteWindowsserverfromwithinavbscriptbyinvoking

I'm trying to run a simple cmd utility on a remote Windows server from within a Vbscript by invoking the Win32_Process class, like so:

我试图通过调用Win32_Process类在Vbscript中的远程Windows服务器上运行一个简单的cmd实用程序,如下所示:

serverIP = "10.0.0.3"
Set oWMI = GetObject("winmgmts:{impersOnationLevel=impersonate}!\\" & serverIP & "\root\cimv2:Win32_Process")
RunCommand = "cmd.exe /c echo hello >c:\hello.txt"
wscript.echo RunCommand
intReturn = oWMI.Create(RunCommand, Null, Null, intProcessID)  
wscript.echo intReturn
Select Case intReturn
        Case 0 Wscript.Echo "Successful"
        Case 2 Wscript.Echo "Access denied"
        Case 3 Wscript.Echo "Insufficient privilege"
        Case 8 Wscript.Echo "Unknown failure"
        Case 9 Wscript.Echo "Path not found"
        Case 21 Wscript.Echo "Invalid parameter"
        Case Else Wscript.Echo "Unable to execute for unknown reason"
End Select

This always fails with insufficient privs (return code 3).

这总是因为privs不足而失败(返回码3)。

Can anyone see what I'm doing wrong? The script is running from a cmd session invoked as a domain admin, so it should work fine, unless there's something about WMI security that I don't fully understand.

谁能看到我做错了什么?该脚本是从作为域管理员调用的cmd会话运行的,因此它应该可以正常工作,除非有一些我不完全理解的WMI安全性。

There will probably be people who suggest PSEXEC. I am aware of it and may fall back to it. But this seems like a solvable problem as is, and I'd rather not create dependencies on outside executables for this script.

可能会有人建议PSEXEC。我知道它,可能会回到它。但这似乎是一个可解决的问题,我宁愿不为此脚本创建外部可执行文件的依赖项。

I'll mention a few things I've tried.

我会提到一些我尝试过的东西。

  • This fellow says there can be an issue if the profile is not loaded. I have the same problem even if the calling user (a domain admin) is logged into both systems.
  • 这位研究员表示如果未加载配置文件可能会出现问题。即使主叫用户(域管理员)登录到两个系统,我也有同样的问题。

  • In this thread, Richard Mueller notes that one should specify both impersOnationlevel=impersonate and authenticatiOnlevel=Pkt. I tried that. Still no go.
  • 在这个主题中,Richard Mueller指出应该指定impersOnationlevel= impersonate和authenticatiOnlevel= Pkt。我试过了。仍然没有去。

  • On this page it seems that one should specify the NT rights needed within the moniker. I have tried specifying SeInteractiveLogonRight, SeNetworkLogonRight, SeBackupPrivilege, SeRestorePrivilege, SeDebugPrivilege, and SeChangeNotifyPrivilege. Nothing worked.
  • 在这个页面上,似乎应该指定名字对象中所需的NT权限。我已经尝试指定SeInteractiveLogonRight,SeNetworkLogonRight,SeBackupPrivilege,SeRestorePrivilege,SeDebugPrivilege和SeChangeNotifyPrivilege。没有任何效果。

A common thread I have noticed in googling this, is that people are seeing this issue with some target computers but not others. So it seems to me that what's fundamentally missing is a full breakdown of the security privs one would need to accomplish this task. A lollipop will be gratefully sent to whomever can provide such a breakdown definitively!

我在谷歌搜索中注意到的一个共同点是人们看到这个问题与一些目标计算机而不是其他人。因此,在我看来,根本上缺少的是完成此任务所需的安全权限的完全分解。棒棒糖将被感激地发送给任何能够明确提供此类故障的人!

In vain hopes it will increase viewership, I'm going to add the .net tag here, since .net folks often deal with the same WMI issues and may have insight.

徒劳地希望它会增加收视率,我将在这里添加.net标签,因为.net人经常处理相同的WMI问题并且可能有洞察力。

Awww. Bump, this isn't going to become a tumbleweed is it?

噢。凹凸不平,这不会成为风滚草吗?

4 个解决方案

#1


I had the similar problem. The suggestion from http://social.technet.microsoft.com/Forums/en-US/winserverManagement/thread/305557c4-df94-4d92-85bf-a049c83f120c helped me. Shortly: ensure that LOCAL SERVICE and NETWORK SERVICE accounts are granted to "Replace a process-level token" (SeAssignPrimaryTokenPrivilege).

我有类似的问题。来自http://social.technet.microsoft.com/Forums/en-US/winserverManagement/thread/305557c4-df94-4d92-85bf-a049c83f120c的建议对我有所帮助。简而言之:确保将LOCAL SERVICE和NETWORK SERVICE帐户授予“替换进程级令牌”(SeAssignPrimaryTokenPrivilege)。

#2


On this page it seems that one should specify the NT rights needed within the moniker. I have tried specifying SeInteractiveLogonRight, SeNetworkLogonRight, SeBackupPrivilege, SeRestorePrivilege, SeDebugPrivilege, and SeChangeNotifyPrivilege. Nothing worked.

在这个页面上,似乎应该指定名字对象中所需的NT权限。我已经尝试指定SeInteractiveLogonRight,SeNetworkLogonRight,SeBackupPrivilege,SeRestorePrivilege,SeDebugPrivilege和SeChangeNotifyPrivilege。没有任何效果。

Note if you were trying to use the privilege strings listed above (directly from the NT rights), that won't work. You should use the moniker privileges shown in table 6.8 of WMI Security Settings

请注意,如果您尝试使用上面列出的权限字符串(直接来自NT权限),那将无效。您应该使用WMI安全设置的表6.8中显示的名字对象权限

(But, if you're already a domain admin and you're just trying to cmd.exe echo > file, that's almost certainly not the issue)

(但是,如果您已经是域管理员,并且您只是尝试使用cmd.exe echo>文件,那几乎肯定不是问题)

#3


Do you find more info about error at log event at server side. This help to diagnose access right fault, or try monitoring access using FileMon.

您是否在服务器端的日志事件中找到有关错误的更多信息。这有助于诊断访问权限错误,或尝试使用FileMon监控访问。

#4


Check out this detailed page on MS Technet excerpted from the book "Advanced Vbscript for Microsoft Windows Administrators" Specifically it is "Chapter 6: Remote Scripting By Don Jones and Jeffery Hicks" and contains details on ensuring the target device is properly configured for remote scripts.

查看MS Technet上的详细页面,摘自“Microsoft Windows管理员高级Vbscript”一书。具体来说,它是“第6章:Don Jones和Jeffery Hicks的远程脚本”,并包含有关确保为远程脚本正确配置目标设备的详细信息。

Also check out c:\winnt\system32\WBEM\logs\wmiprov.txt I bet you're seeing something like this:

还看看c:\ winnt \ system32 \ WBEM \ logs \ wmiprov.txt我打赌你看到的是这样的:

(Mon Jun 01 16:57:19 2009.2x) : ***************************************
(Mon Jun 01 16:57:19 2009.2x) : Could not get pointer to binary resource for file:
(Mon Jun 01 16:57:19 2009.2x) : C:\WINNT\system32\DRIVERS\wmiacpi.sys[MofResource](Mon Jun 01 16:57:19 2009.2x) : 
(Mon Jun 01 16:57:19 2009.2x) : ***************************************

推荐阅读
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • 本文讨论了在openwrt-17.01版本中,mt7628设备上初始化启动时eth0的mac地址总是随机生成的问题。每次随机生成的eth0的mac地址都会写到/sys/class/net/eth0/address目录下,而openwrt-17.01原版的SDK会根据随机生成的eth0的mac地址再生成eth0.1、eth0.2等,生成后的mac地址会保存在/etc/config/network下。 ... [详细]
  • 深入理解Kafka服务端请求队列中请求的处理
    本文深入分析了Kafka服务端请求队列中请求的处理过程,详细介绍了请求的封装和放入请求队列的过程,以及处理请求的线程池的创建和容量设置。通过场景分析、图示说明和源码分析,帮助读者更好地理解Kafka服务端的工作原理。 ... [详细]
  • 预备知识可参考我整理的博客Windows编程之线程:https:www.cnblogs.comZhuSenlinp16662075.htmlWindows编程之线程同步:https ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • 生成式对抗网络模型综述摘要生成式对抗网络模型(GAN)是基于深度学习的一种强大的生成模型,可以应用于计算机视觉、自然语言处理、半监督学习等重要领域。生成式对抗网络 ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
  • 本文介绍了游标的使用方法,并以一个水果供应商数据库为例进行了说明。首先创建了一个名为fruits的表,包含了水果的id、供应商id、名称和价格等字段。然后使用游标查询了水果的名称和价格,并将结果输出。最后对游标进行了关闭操作。通过本文可以了解到游标在数据库操作中的应用。 ... [详细]
  • 本文介绍了Windows操作系统的版本及其特点,包括Windows 7系统的6个版本:Starter、Home Basic、Home Premium、Professional、Enterprise、Ultimate。Windows操作系统是微软公司研发的一套操作系统,具有人机操作性优异、支持的应用软件较多、对硬件支持良好等优点。Windows 7 Starter是功能最少的版本,缺乏Aero特效功能,没有64位支持,最初设计不能同时运行三个以上应用程序。 ... [详细]
  • 无详细内容MySQLmysqlmysqlDELIMITERmysqlCREATEFUNCTIONmyProc(costDECIMAL(10,2))-RETURNSDECIMAL(1 ... [详细]
  • SpringBoot整合SpringSecurity+JWT实现单点登录
    SpringBoot整合SpringSecurity+JWT实现单点登录,Go语言社区,Golang程序员人脉社 ... [详细]
author-avatar
穿过a黑夜_440
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有