#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    4
    Rep 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...
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2009
    Location
    Australia
    Posts
    1
    Rep Power
    0
    Originally Posted by nakshathra
    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"
    Did you manage to find any answer or workaround?. I am having similar issue

    ActiveX component can't create object: 'GetObject' when i try to get User object from LDAP to query the property.

    Thanks

IMN logo majestic logo threadwatch logo seochat tools logo