
March 13th, 2009, 12:25 AM
|
|
Registered User
|
|
Join Date: Mar 2009
Posts: 4
Time spent in forums: 1 h 30 m 6 sec
Reputation Power: 0
|
|
|
How to use Getobject in vbscript?
Hi,
I want to get my system details using vbscript. The following code is working fine in server but when i place this is my desktop its not working. Its show the error as " ActiveX component can't create object: Getobject"
Code:
<html>
<script language="vbscript">
Function test1(ipaddres)
answer=MsgBox("Hello everyone, System is writing, Your System level Details!",65,"Example")
Dim filename
filename="c:\Program Files\softwaretest.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile(filename, True)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product")
For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.Caption & vbtab & "||" & vbtab & _
objSoftware.Version & vbtab & "~~"
Next
objTextFile.Close
End Function
</script>
<body bgcolor='lightyellow'>
<input type=button value='check' onclick='test1(111)'>
</body>
</html>
Many thanks...
|