Need Help with this script

Discussion in 'Scripting & Programming' started by aertaher, May 20, 2009.

  1. aertaher

    aertaher New Member

    2
    0
    1
    it suppouse to report some hardware inventory and dumb the info in a word document, but instead i get a blank doc any idea?

    On Error Resume Next

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

    Set colItems = objWMIService.ExecQuery("Select * from Win32_PnPSignedDriver")

    Set objWord = CreateObject("Word.Application")

    objWord.Visible = True

    objWord.documents.Add

    For Each objItem in colItems
    Echo "Device ID: " & objItem.DeviceID
    Echo "Device Name: " & objItem.DeviceName
    dtmWMIDate = objItem.DriverDate
    strReturn = WMIDateStringToDate(dtmWMIDate)
    Echo "Driver Date: " & strReturn
    Echo "Driver Provider Name: " & objItem.DriverProviderName
    Echo "Driver Version: " & objItem.DriverVersion
    Echo "Hardware ID: " & objItem.HardWareID
    Echo "INF Name: " & objItem.InfName
    Echo "Is Signed: " & objItem.IsSigned
    Echo "Manufacturer: " & objItem.Manufacturer
    Echo
    Next

    Function WMIDateStringToDate(dtmWMIDate)
    If Not IsNull(dtmWMIDate) Then
    WMIDateStringToDate = CDate(Mid(dtmWMIDate, 5, 2) & "/" & _
    Mid(dtmWMIDate, 7, 2) & "/" & Left(dtmWMIDate, 4) _
    & " " & Mid (dtmWMIDate, 9, 2) & ":" & _
    Mid(dtmWMIDate, 11, 2) & ":" & Mid(dtmWMIDate,13, 2))
    End If
    End Function

    Wscript.Echo "Complete"
     

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.