![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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. 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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 > > -- 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 Specs![]() |
![]() |
| 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 | |||