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 - Error 2 when creating an object

Reply
 
Old 03-09-2009   #1 (permalink)
Joe


 
 

Error 2 when creating an object

I have a script that is launching an application similar to below:

strComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & strComputer &
"\root\cimv2:Win32_Process")
Err = objWMIService.Create("Notepad.exe", Null, Null, intProcessID)
wscript.echo "Error # " & Err & vbCrLf & Err.Description

When I try to create the object I get Error 2.

Now I know that it has to do with the hardening scripts. Is there a quick
way to tell whether this is a Registry issue, OS Permissions or DCOM
permissions?

Any help would be greatly appreciated.

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


 
 

Re: Error 2 when creating an object


"Joe" <Joe@xxxxxx> wrote in message
news08C9AFE-EC5C-4D26-AEF8-F32233846F85@xxxxxx
Quote:

>I have a script that is launching an application similar to below:
>
> strComputer = "."
> Set objWMIService = GetObject ("winmgmts:\\" & strComputer &
> "\root\cimv2:Win32_Process")
> Err = objWMIService.Create("Notepad.exe", Null, Null, intProcessID)
> wscript.echo "Error # " & Err & vbCrLf & Err.Description
>
> When I try to create the object I get Error 2.
>
> Now I know that it has to do with the hardening scripts. Is there a quick
> way to tell whether this is a Registry issue, OS Permissions or DCOM
> permissions?
>
> Any help would be greatly appreciated.
First, I would try:

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2:Win32_Process")

Next, for troubleshooting WMI see these links:

http://www.microsoft.com/technet/scr.../help/wmi.mspx

http://support.microsoft.com/kb/875605

http://www.microsoft.com/technet/scr...es/wmifaq.mspx

You can rebuild the WMI repository, if you have XP SP2, with the command:

rundll32 wbemupgd, UpgradeRepository

The following commands reinstall WMI in the registry:

winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf

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


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Creating XPathDocument object in Powershell PowerShell
Problem with ActiveX creating object on IE 7 in Vista Vista General
Creating an array of floats using new-object PowerShell
False IE doc body error - "Object reference not set to an instance of an object" PowerShell
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


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