ActiveX Component

Asked By vinayaga moorthi A
02-Feb-10 07:33 AM
Earn up to 0 extra points for answering this tough question.

when call this vb script function in body on load event it display the error

Activex Component object can't created 'GetObject'

My Code

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<script type="text/vbscript">

Function greeting()

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _

("Select * from Win32_Service where Name='Spooler'")

For each objService in colServiceList

errReturn = objService.StopService()

Set FileList = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='C:\Windows\system32\spool\printers'} Where " & "ResultClass = CIM_DataFile")

For Each objFile In FileList

objFile.Delete

Next

Next

Set colServiceList = objWMIService.ExecQuery _

("Select * from Win32_Service where Name='Spooler'")

For each objService in colServiceList

errReturn = objService.StartService()

Next

//WScript.Echo ("Script Complete")

End Function

</script>

<title>Untitled Page</title>

</head>

<body onload=greeting()>

<form id="form1" runat="server">

<div>

<asp:Button ID="Print" runat="server" Text="Print" />

<asp:Button ID="Clear" runat="server" Text="Clear" /></div>

</form>

</body>

</html>

  re: ActiveX Component

Sakshi a replied to vinayaga moorthi A
02-Feb-10 07:40 AM

see the Microsoft solution here and one more also see this.

regards,

www.codecollege.net

 

Create New Account