热门标签 | 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) : ***************************************

推荐阅读
  • Python正则表达式学习记录及常用方法
    本文记录了学习Python正则表达式的过程,介绍了re模块的常用方法re.search,并解释了rawstring的作用。正则表达式是一种方便检查字符串匹配模式的工具,通过本文的学习可以掌握Python中使用正则表达式的基本方法。 ... [详细]
  • 本文介绍了游标的使用方法,并以一个水果供应商数据库为例进行了说明。首先创建了一个名为fruits的表,包含了水果的id、供应商id、名称和价格等字段。然后使用游标查询了水果的名称和价格,并将结果输出。最后对游标进行了关闭操作。通过本文可以了解到游标在数据库操作中的应用。 ... [详细]
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 本文介绍了OpenStack的逻辑概念以及其构成简介,包括了软件开源项目、基础设施资源管理平台、三大核心组件等内容。同时还介绍了Horizon(UI模块)等相关信息。 ... [详细]
  • 基于PgpoolII的PostgreSQL集群安装与配置教程
    本文介绍了基于PgpoolII的PostgreSQL集群的安装与配置教程。Pgpool-II是一个位于PostgreSQL服务器和PostgreSQL数据库客户端之间的中间件,提供了连接池、复制、负载均衡、缓存、看门狗、限制链接等功能,可以用于搭建高可用的PostgreSQL集群。文章详细介绍了通过yum安装Pgpool-II的步骤,并提供了相关的官方参考地址。 ... [详细]
  • Linux服务器密码过期策略、登录次数限制、私钥登录等配置方法
    本文介绍了在Linux服务器上进行密码过期策略、登录次数限制、私钥登录等配置的方法。通过修改配置文件中的参数,可以设置密码的有效期、最小间隔时间、最小长度,并在密码过期前进行提示。同时还介绍了如何进行公钥登录和修改默认账户用户名的操作。详细步骤和注意事项可参考本文内容。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • 推荐系统遇上深度学习(十七)详解推荐系统中的常用评测指标
    原创:石晓文小小挖掘机2018-06-18笔者是一个痴迷于挖掘数据中的价值的学习人,希望在平日的工作学习中,挖掘数据的价值, ... [详细]
  • http:my.oschina.netleejun2005blog136820刚看到群里又有同学在说HTTP协议下的Get请求参数长度是有大小限制的,最大不能超过XX ... [详细]
  • Linux如何安装Mongodb的详细步骤和注意事项
    本文介绍了Linux如何安装Mongodb的详细步骤和注意事项,同时介绍了Mongodb的特点和优势。Mongodb是一个开源的数据库,适用于各种规模的企业和各类应用程序。它具有灵活的数据模式和高性能的数据读写操作,能够提高企业的敏捷性和可扩展性。文章还提供了Mongodb的下载安装包地址。 ... [详细]
  • 本文介绍了Windows操作系统的版本及其特点,包括Windows 7系统的6个版本:Starter、Home Basic、Home Premium、Professional、Enterprise、Ultimate。Windows操作系统是微软公司研发的一套操作系统,具有人机操作性优异、支持的应用软件较多、对硬件支持良好等优点。Windows 7 Starter是功能最少的版本,缺乏Aero特效功能,没有64位支持,最初设计不能同时运行三个以上应用程序。 ... [详细]
  • 深度学习中的Vision Transformer (ViT)详解
    本文详细介绍了深度学习中的Vision Transformer (ViT)方法。首先介绍了相关工作和ViT的基本原理,包括图像块嵌入、可学习的嵌入、位置嵌入和Transformer编码器等。接着讨论了ViT的张量维度变化、归纳偏置与混合架构、微调及更高分辨率等方面。最后给出了实验结果和相关代码的链接。本文的研究表明,对于CV任务,直接应用纯Transformer架构于图像块序列是可行的,无需依赖于卷积网络。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • 本文详细介绍了cisco路由器IOS损坏时的恢复方法,包括进入ROMMON模式、设置IP地址、子网掩码、默认网关以及使用TFTP服务器传输IOS文件的步骤。 ... [详细]
author-avatar
bj_gqdy_342
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有