Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11691

Re: VBS script / wmi security conf DACL

Newsgroups microsoft.public.scripting.vbscript
Date 2017-05-22 22:27 -0700
References <5faa05a7-4c93-4564-8312-2e381aa529a5@googlegroups.com> <ofvobd$gt6$2@dont-email.me>
Message-ID <dc13bf59-b796-4611-8535-8fca5c2e67cf@googlegroups.com> (permalink)
Subject Re: VBS script / wmi security conf DACL
From emre.ytu@gmail.com

Show all headers | View raw


On Tuesday, May 23, 2017 at 1:26:03 AM UTC+3, Dave "Crash" Dummy wrote:
> emre.ytu@gmail.com wrote:
> > Hello,
> > 
> > I am trying to write a vbs script that configures WMI security. I want to use byte stream example in link below.
> > 
> > https://blogs.msdn.microsoft.com/spatdsg/2007/11/21/set-wmi-namespace-security-via-gpo-script/
> > 
> > https://www.youtube.com/watch?v=_e0ZrknsLFE
> > 
> > I did the same and generated script:
> > 
> > strSD = array(1,0,20,130,192,0,0,0,208,0,0,0,20,0,0,0,64,0,0,0,2,0,44,0,1,0,0,0,2,194,36,0,31,0,6,0,1,5,0,0,0,0,0,5,21,0,0,0,91,16,155,64,69,109,31,3,188,108,130,0,191,80,2,0,2,0,128,0,5,0,0,0,0,2,20,0,19,0,0,0,1,1,0,0,0,0,0,5,11,0,0,0,0,2,20,0,19,0,0,0,1,1,0,0,0,0,0,5,19,0,0,0,0,2,20,0,19,0,0,0,1,1,0,0,0,0,0,5,20,0,0,0,0,2,24,0,63,0,6,0,1,2,0,0,0,0,0,5,32,0,0,0,32,2,0,0,0,2,36,0,63,0,6,0,1,5,0,0,0,0,0,5,21,0,0,0,91,16,155,64,69,109,31,3,188,108,130,0,191,80,2,0,1,2,0,0,0,0,0,5,32,0,0,0,32,2,0,0,1,2,0,0,0,0,0,5,32,0,0,0,32,2,0,0)
> > 
> > set namespace = createobject("wbemscripting.swbemlocator").connectserver(,"root")
> > 
> > set security = namespace.get("__systemsecurity=@")
> > 
> > nStatus = security.setsd(strSD)
> > 
> > I get error below when I run as an admin:
> > 
> > Privilege not held
> > Line:7
> > Char:1
> > Source: SWbemObjectEx
> 
> Put this code in the start of your script:
> 
> Set WshShell = WScript.CreateObject("WScript.Shell")
> If WScript.Arguments.length = 0 Then
> 	Set ObjShell = CreateObject("Shell.Application")
> 	ObjShell.ShellExecute "wscript.exe", """" & _
> 	WScript.ScriptFullName & """" &_
> 	 " RunAsAdministrator", , "runas", 1
> Else
> 
> 	Put your code here
> 
> End if
> 
> -- 
> Crash
> 
> Democracy is government by the basest emotions of slightly over half the 
> population.

Hello Dave,

I have updated my code just like you said but I still get error.

Privilege Not Held
Line 15
Char 2

which is pointing the line starts with "nStatus"

Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

VBS script / wmi security conf DACL emre.ytu@gmail.com - 2017-05-22 07:51 -0700
  Re: VBS script / wmi security conf DACL "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-05-22 10:56 -0400
    Re: VBS script / wmi security conf DACL emre.ytu@gmail.com - 2017-05-22 22:52 -0700
  Re: VBS script / wmi security conf DACL JJ <jj4public@vfemail.net> - 2017-05-23 03:10 +0700
    Re: VBS script / wmi security conf DACL emre.ytu@gmail.com - 2017-05-22 22:24 -0700
  Re: VBS script / wmi security conf DACL "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-05-22 18:11 -0400
  Re: VBS script / wmi security conf DACL "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-05-22 18:26 -0400
    Re: VBS script / wmi security conf DACL emre.ytu@gmail.com - 2017-05-22 22:27 -0700
      Re: VBS script / wmi security conf DACL JJ <jj4public@vfemail.net> - 2017-05-23 17:30 +0700
        Re: VBS script / wmi security conf DACL "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-05-23 10:11 -0400
          Re: VBS script / wmi security conf DACL JJ <jj4public@vfemail.net> - 2017-05-24 16:03 +0700

csiph-web