Click to See Complete Forum and Search --> : microsoft vbscript runtime error:activex component can't create:'GetObject'


anbumanikandan
November 5th, 2006, 12:58 PM
hai everybody

when i am executes these code.i received

--> this error "microsoft vbscript runtime error:activex component can't create:'GetObject'"

==> for this line "Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")"

please help me to rectify this code.

thanks

<html>
<head>
<title>vbs testing</title>
<script language=vbs>
sub display()
Dim strComputer,fso,objTxtFile,objWMIService

strComputer = document.myform.mytext.value
msgbox strComputer

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

set fso=createobject("Scripting.FileSystemObject")
set objTextFile=fs.CreateFileText("C:\sam301006.txt",true)

Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")

For Each objService in colRunningServices
Wscript.Echo objService.DisplayName & VbTab & objService.State
objTextFile.writeline(objService.DisplayName & VbTab & objService.State)
Next
end sub
</script>
</head>
<body>
<form name=myform >
<input type=text name=mytext>
<input type=submit name=mysubmit onclick=display>
</form>
</body>
</html>

PeejAvery
November 5th, 2006, 05:17 PM
You are using Internet Explorer and not Firefox right?

anbumanikandan
November 11th, 2006, 12:11 AM
No. not at all

i am running in ie.

i am encoding wscript in vbscript which is residing in hmtl.

please me to solve this problem.

thanks

PeejAvery
November 13th, 2006, 09:51 AM
Is your Windows Managment Service running?