Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - WMI Security question...

Reply
 
Old 12-09-2008   #1 (permalink)
Joe


 
 

WMI Security question...

I am having an issue running some code on a server. I am getting an Access
Denied error when trying to run this code.

strComputer = "."
strCommand = "Calc.exe"

Set objWMIService = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\"
& strComputer & "\root\cimv2")

' Configure the Calc process to show a window
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = 1

' Create Calc process
Set objProcess = objWMIService.Get("Win32_Process")

intReturn = objProcess.Create (strCommand, Null, objConfig, intProcessID)

If intReturn <> 0 Then
Wscript.Echo "Process could not be created." & _
vbcrlf & "Command line: " & strCommand & _
vbcrlf & "Return value: " & intReturn
Else
Wscript.Echo "Process created." & _
vbcrlf & "Command line: " & strCommand & _
vbcrlf & "Process ID: " & intProcessID
End If

What I need to do is to query what rights accounts have when trying to start
an application like this. I'm just not clear on how to do it.

Any help would be appreciated.

My System SpecsSystem Spec
Old 12-09-2008   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: WMI Security question...


"Joe" <Joe@xxxxxx> wrote in message
news:5B2D64AB-6F4B-4382-A2F3-A18EFE8145FD@xxxxxx
Quote:

>I am having an issue running some code on a server. I am getting an Access
> Denied error when trying to run this code.
>
> strComputer = "."
> strCommand = "Calc.exe"
>
> Set objWMIService =
> GetObject("winmgmts:{impersonationLevel=Impersonate}!\\"
> & strComputer & "\root\cimv2")
>
> ' Configure the Calc process to show a window
> Set objStartup = objWMIService.Get("Win32_ProcessStartup")
> Set objConfig = objStartup.SpawnInstance_
> objConfig.ShowWindow = 1
>
> ' Create Calc process
> Set objProcess = objWMIService.Get("Win32_Process")
>
> intReturn = objProcess.Create (strCommand, Null, objConfig, intProcessID)
>
> If intReturn <> 0 Then
> Wscript.Echo "Process could not be created." & _
> vbcrlf & "Command line: " & strCommand & _
> vbcrlf & "Return value: " & intReturn
> Else
> Wscript.Echo "Process created." & _
> vbcrlf & "Command line: " & strCommand & _
> vbcrlf & "Process ID: " & intProcessID
> End If
>
> What I need to do is to query what rights accounts have when trying to
> start
> an application like this. I'm just not clear on how to do it.
>
> Any help would be appreciated.
In general you need to be a member of the local Administrators group on the
computer. By default the domain group "Domain Admins" is added to the local
Administrators group when the computer is joined to the domain. What OS is
installed?

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 12-10-2008   #3 (permalink)
Joe


 
 

Re: WMI Security question...

The account is an admin on the box. And this is Windows 2003 Server.

Can I simulate this with WBEMTest? Would that give me more information?

I can't track down where the Access denied is being generated from. I need
to track this down.

Thanks.

"Richard Mueller [MVP]" wrote:
Quote:

>
> "Joe" <Joe@xxxxxx> wrote in message
> news:5B2D64AB-6F4B-4382-A2F3-A18EFE8145FD@xxxxxx
Quote:

> >I am having an issue running some code on a server. I am getting an Access
> > Denied error when trying to run this code.
> >
> > strComputer = "."
> > strCommand = "Calc.exe"
> >
> > Set objWMIService =
> > GetObject("winmgmts:{impersonationLevel=Impersonate}!\\"
> > & strComputer & "\root\cimv2")
> >
> > ' Configure the Calc process to show a window
> > Set objStartup = objWMIService.Get("Win32_ProcessStartup")
> > Set objConfig = objStartup.SpawnInstance_
> > objConfig.ShowWindow = 1
> >
> > ' Create Calc process
> > Set objProcess = objWMIService.Get("Win32_Process")
> >
> > intReturn = objProcess.Create (strCommand, Null, objConfig, intProcessID)
> >
> > If intReturn <> 0 Then
> > Wscript.Echo "Process could not be created." & _
> > vbcrlf & "Command line: " & strCommand & _
> > vbcrlf & "Return value: " & intReturn
> > Else
> > Wscript.Echo "Process created." & _
> > vbcrlf & "Command line: " & strCommand & _
> > vbcrlf & "Process ID: " & intProcessID
> > End If
> >
> > What I need to do is to query what rights accounts have when trying to
> > start
> > an application like this. I'm just not clear on how to do it.
> >
> > Any help would be appreciated.
>
> In general you need to be a member of the local Administrators group on the
> computer. By default the domain group "Domain Admins" is added to the local
> Administrators group when the computer is joined to the domain. What OS is
> installed?
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
My System SpecsSystem Spec
Old 12-10-2008   #4 (permalink)
Tom Lavedas


 
 

Re: WMI Security question...

On Dec 10, 3:58*pm, Joe <J...@xxxxxx> wrote:
Quote:

> The account is an admin on the box. *And this is Windows 2003 Server.
>
> Can I simulate this with WBEMTest? *Would that give me more information?
>
> I can't track down where the Access denied is being generated from. *I need
> to track this down.
>
> Thanks.
>
> "Richard Mueller [MVP]" wrote:
>
Quote:

> > "Joe" <J...@xxxxxx> wrote in message
> >news:5B2D64AB-6F4B-4382-A2F3-A18EFE8145FD@xxxxxx
Quote:

> > >I am having an issue running some code on a server. *I am getting anAccess
> > > Denied error when trying to run this code.
>
Quote:
Quote:

> > > strComputer = "."
> > > strCommand = "Calc.exe"
>
Quote:
Quote:

> > > Set objWMIService =
> > > GetObject("winmgmts:{impersonationLevel=Impersonate}!\\"
> > > & strComputer & "\root\cimv2")
>
Quote:
Quote:

> > > ' Configure the Calc process to show a window
> > > Set objStartup = objWMIService.Get("Win32_ProcessStartup")
> > > Set objConfig = objStartup.SpawnInstance_
> > > objConfig.ShowWindow = 1
>
Quote:
Quote:

> > > ' Create Calc process
> > > Set objProcess = objWMIService.Get("Win32_Process")
>
Quote:
Quote:

> > > intReturn = objProcess.Create (strCommand, Null, objConfig, intProcessID)
>
Quote:
Quote:

> > > If intReturn <> 0 Then
> > > * *Wscript.Echo "Process could not be created." & _
> > > * * * *vbcrlf & "Command line: " & strCommand & _
> > > * * * *vbcrlf & "Return value: " & intReturn
> > > Else
> > > * *Wscript.Echo "Process created." & _
> > > * * * vbcrlf & "Command line: " & strCommand & _
> > > * * * vbcrlf & "Process ID: " & intProcessID
> > > End If
>
Quote:
Quote:

> > > What I need to do is to query what rights accounts have when trying to
> > > start
> > > an application like this. *I'm just not clear on how to do it.
>
Quote:
Quote:

> > > Any help would be appreciated.
>
Quote:

> > In general you need to be a member of the local Administrators group onthe
> > computer. By default the domain group "Domain Admins" is added to the local
> > Administrators group when the computer is joined to the domain. What OSis
> > installed?
>
Quote:

> > --
> > Richard Mueller
> > MVP Directory Services
> > Hilltop Lab -http://www.rlmueller.net
> > --
This worked fine for me on my local machine. Maybe the OP is not
trying to execute this as a logged in user, but rather as a scheduled
task or on other than the local machine. If either of the latter is
the case, it can't work, can it, since there is no console (desktop)
available to display the application's window? I'm not certain
whether setting the session as 'interactive' will solve the problem
(if it's scheduled. I don't think it does. I'm almost positive WMI
cannot be used to run an interactive application on a remote machine.
I'm not familiar with an application that can.

I think there is something going on that the OP is not aware is
restricting the operation of this script. Clearly the use of Calc.exe
is just an example, not the real need. I would suggest the OP be more
specific in describing his intent.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Security Log Question? System Security
Security Question Vista security
File Security Question Vista security
File security question Vista security


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46