![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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 Error 2 I am running a VBScript to start an application and I am getting a return error code of 2 (access denied). Now I take it that the access denied is to the \\.\root\CIMV2, but how can I verify this? I get the same error whether using impersonationlevel=impersonate or removing that. Any help would be appreciated. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: WMI Error 2 "Joe" <Joe@xxxxxx> wrote in message news:7FD36CEF-FD36-4DB4-B3A0-BD5C6FF4072A@xxxxxx Quote: >I am running a VBScript to start an application and I am getting a return > error code of 2 (access denied). > > Now I take it that the access denied is to the \\.\root\CIMV2, but how can > I > verify this? > > I get the same error whether using impersonationlevel=impersonate or > removing that. > > Any help would be appreciated. methods of the WScript.Shell object will easily do it for you. Anyway - let's have a look at your script. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: WMI Error 2 Script is attached. It is a simple sample program, but it is the basis for the script that we are planning on using. Const HIDDEN_WINDOW = 0 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set objStartup = objWMIService.Get("Win32_ProcessStartup") Set objConfig = objStartup.SpawnInstance_ objConfig.ShowWindow = HIDDEN_WINDOW Set objProcess = GetObject( _ "winmgmts:root\cimv2:Win32_Process") errReturn = objProcess.Create( _ "notepad.exe", null, objConfig, intProcessID) wscript.echo errReturn "Pegasus (MVP)" wrote: Quote: > > "Joe" <Joe@xxxxxx> wrote in message > news:7FD36CEF-FD36-4DB4-B3A0-BD5C6FF4072A@xxxxxx Quote: > >I am running a VBScript to start an application and I am getting a return > > error code of 2 (access denied). > > > > Now I take it that the access denied is to the \\.\root\CIMV2, but how can > > I > > verify this? > > > > I get the same error whether using impersonationlevel=impersonate or > > removing that. > > > > Any help would be appreciated. > You don't usually need WMI to launch an application - the exec or run > methods of the WScript.Shell object will easily do it for you. Anyway - > let's have a look at your script. > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: WMI Error 2 I'm a strong believer in the KISS principle, hence I would use this code: Set ObjWshShell = WScript.CreateObject("WScript.Shell") ErrReturn = ObjWshShell.Run("notepad.exe") "Joe" <Joe@xxxxxx> wrote in message news:5E2E0835-4587-4AD4-B153-06D3093F78C1@xxxxxx Quote: > Script is attached. It is a simple sample program, but it is the basis > for > the script > that we are planning on using. > > Const HIDDEN_WINDOW = 0 > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" _ > & strComputer & "\root\cimv2") > Set objStartup = objWMIService.Get("Win32_ProcessStartup") > Set objConfig = objStartup.SpawnInstance_ > objConfig.ShowWindow = HIDDEN_WINDOW > Set objProcess = GetObject( _ > "winmgmts:root\cimv2:Win32_Process") > errReturn = objProcess.Create( _ > "notepad.exe", null, objConfig, intProcessID) > wscript.echo errReturn > > "Pegasus (MVP)" wrote: > Quote: >> >> "Joe" <Joe@xxxxxx> wrote in message >> news:7FD36CEF-FD36-4DB4-B3A0-BD5C6FF4072A@xxxxxx Quote: >> >I am running a VBScript to start an application and I am getting a >> >return >> > error code of 2 (access denied). >> > >> > Now I take it that the access denied is to the \\.\root\CIMV2, but how >> > can >> > I >> > verify this? >> > >> > I get the same error whether using impersonationlevel=impersonate or >> > removing that. >> > >> > Any help would be appreciated. >> You don't usually need WMI to launch an application - the exec or run >> methods of the WScript.Shell object will easily do it for you. Anyway - >> let's have a look at your script. >> >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: WMI Error 2 Agreed, that would be nice. However it would also be nice to figure out where this is actually failing. And then being able to fix the underlying cause. "Pegasus (MVP)" wrote: Quote: > I'm a strong believer in the KISS principle, hence I would use this code: > > Set ObjWshShell = WScript.CreateObject("WScript.Shell") > ErrReturn = ObjWshShell.Run("notepad.exe") > > > "Joe" <Joe@xxxxxx> wrote in message > news:5E2E0835-4587-4AD4-B153-06D3093F78C1@xxxxxx Quote: > > Script is attached. It is a simple sample program, but it is the basis > > for > > the script > > that we are planning on using. > > > > Const HIDDEN_WINDOW = 0 > > strComputer = "." > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" _ > > & strComputer & "\root\cimv2") > > Set objStartup = objWMIService.Get("Win32_ProcessStartup") > > Set objConfig = objStartup.SpawnInstance_ > > objConfig.ShowWindow = HIDDEN_WINDOW > > Set objProcess = GetObject( _ > > "winmgmts:root\cimv2:Win32_Process") > > errReturn = objProcess.Create( _ > > "notepad.exe", null, objConfig, intProcessID) > > wscript.echo errReturn > > > > "Pegasus (MVP)" wrote: > > Quote: > >> > >> "Joe" <Joe@xxxxxx> wrote in message > >> news:7FD36CEF-FD36-4DB4-B3A0-BD5C6FF4072A@xxxxxx > >> >I am running a VBScript to start an application and I am getting a > >> >return > >> > error code of 2 (access denied). > >> > > >> > Now I take it that the access denied is to the \\.\root\CIMV2, but how > >> > can > >> > I > >> > verify this? > >> > > >> > I get the same error whether using impersonationlevel=impersonate or > >> > removing that. > >> > > >> > Any help would be appreciated. > >> > >> You don't usually need WMI to launch an application - the exec or run > >> methods of the WScript.Shell object will easily do it for you. Anyway - > >> let's have a look at your script. > >> > >> > >> > > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: WMI Error 2 I forgot to mention in my previous reply that I ran your code on my machine without any problems. If you insist on using WMI to invoke external applications then you might consider the simple code below: strComputer = "." Set objWMIService = GetObject _ ("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") Err = objWMIService.Create("Notepaad.exe", Null, Null, intProcessID) It comes from here: http://www.microsoft.com/technet/scr...7/hey0426.mspx "Joe" <Joe@xxxxxx> wrote in message news:5E2E0835-4587-4AD4-B153-06D3093F78C1@xxxxxx Quote: > Script is attached. It is a simple sample program, but it is the basis > for > the script > that we are planning on using. > > Const HIDDEN_WINDOW = 0 > strComputer = "." > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate}!\\" _ > & strComputer & "\root\cimv2") > Set objStartup = objWMIService.Get("Win32_ProcessStartup") > Set objConfig = objStartup.SpawnInstance_ > objConfig.ShowWindow = HIDDEN_WINDOW > Set objProcess = GetObject( _ > "winmgmts:root\cimv2:Win32_Process") > errReturn = objProcess.Create( _ > "notepad.exe", null, objConfig, intProcessID) > wscript.echo errReturn > > "Pegasus (MVP)" wrote: > Quote: >> >> "Joe" <Joe@xxxxxx> wrote in message >> news:7FD36CEF-FD36-4DB4-B3A0-BD5C6FF4072A@xxxxxx Quote: >> >I am running a VBScript to start an application and I am getting a >> >return >> > error code of 2 (access denied). >> > >> > Now I take it that the access denied is to the \\.\root\CIMV2, but how >> > can >> > I >> > verify this? >> > >> > I get the same error whether using impersonationlevel=impersonate or >> > removing that. >> > >> > Any help would be appreciated. >> You don't usually need WMI to launch an application - the exec or run >> methods of the WScript.Shell object will easily do it for you. Anyway - >> let's have a look at your script. >> >> >> |
My System Specs![]() |
| | #7 (permalink) |
| | Re: WMI Error 2 Thank you. The code does run on a non hardened laptop, but not a hardened one. So I guess it is back to permissions in root/CIMv2 where the Access Denied is showing up. "Pegasus (MVP)" wrote: Quote: > I forgot to mention in my previous reply that I ran your code on my machine > without any problems. If you insist on using WMI to invoke external > applications then you might consider the simple code below: > strComputer = "." > Set objWMIService = GetObject _ > ("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") > Err = objWMIService.Create("Notepaad.exe", Null, Null, intProcessID) > > It comes from here: > http://www.microsoft.com/technet/scr...7/hey0426.mspx > > > "Joe" <Joe@xxxxxx> wrote in message > news:5E2E0835-4587-4AD4-B153-06D3093F78C1@xxxxxx Quote: > > Script is attached. It is a simple sample program, but it is the basis > > for > > the script > > that we are planning on using. > > > > Const HIDDEN_WINDOW = 0 > > strComputer = "." > > Set objWMIService = GetObject("winmgmts:" _ > > & "{impersonationLevel=impersonate}!\\" _ > > & strComputer & "\root\cimv2") > > Set objStartup = objWMIService.Get("Win32_ProcessStartup") > > Set objConfig = objStartup.SpawnInstance_ > > objConfig.ShowWindow = HIDDEN_WINDOW > > Set objProcess = GetObject( _ > > "winmgmts:root\cimv2:Win32_Process") > > errReturn = objProcess.Create( _ > > "notepad.exe", null, objConfig, intProcessID) > > wscript.echo errReturn > > > > "Pegasus (MVP)" wrote: > > Quote: > >> > >> "Joe" <Joe@xxxxxx> wrote in message > >> news:7FD36CEF-FD36-4DB4-B3A0-BD5C6FF4072A@xxxxxx > >> >I am running a VBScript to start an application and I am getting a > >> >return > >> > error code of 2 (access denied). > >> > > >> > Now I take it that the access denied is to the \\.\root\CIMV2, but how > >> > can > >> > I > >> > verify this? > >> > > >> > I get the same error whether using impersonationlevel=impersonate or > >> > removing that. > >> > > >> > Any help would be appreciated. > >> > >> You don't usually need WMI to launch an application - the exec or run > >> methods of the WScript.Shell object will easily do it for you. Anyway - > >> let's have a look at your script. > >> > >> > >> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Help with windows vista mail, Socket Error: 10053, Error Number: 0x800CCC0F | Vista mail | |||
| no,socket Error: 11003. Error Number: 0x800CC0D cant i send email name is correctly | Vista mail | |||
| Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F | Vista mail | |||
| Canot post to newsgroups Socket Error: 10053, Error Number: 0x800CCC0F | Vista General | |||
| windows live mail 2008 (Build 12.0.1606) error report error | Windows Live | |||