Advertisement
Advertisement
| 08.15.2008 at 08:43AM PDT, ID: 23651624 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: |
'====================================================================================================
'= Script Name: GetInstalledSoftware.vbs
'= Author: Denis Hubanic
'= Created on: 2008-04-23
'= Last Modified: 2008-08-15
'= By: Denis Hubanic
'= Version: 1.1
'= Description: Script connects to remote PC and gathers a list of all installed MSI's
'= Notes: Results are displayed in formated Excel spreadsheet.
'====================================================================================================
On Error Resume Next
Dim oExcel,oWorkBooks,oWorksheet,oRange
Const cPWTitlebar = "Get Installed Software"
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oNet = CreateObject("wscript.network")
Set oWS = CreateObject("wscript.shell")
sFolder = oFS.GetSpecialFolder(2)
sLocCompName = oNet.ComputerName
sComputer = WScript.Arguments(0)
If sComputer = "" Then
Do
sComputer = InputBox("Please enter Computer Name of the computer you wish to connect to?", cPWTitlebar,sLocCompName)
If Len(sComputer) = 0 Then
sRes = oWS.Popup ("Sorry, you must enter Computer Name to continue. Do you wish to try again?", , cPWTitlebar, vbExclamation+vbYesNo)
If sRes = vbNo Then
WScript.Quit
End If
End If
Loop Until Len(sComputer) <> 0
End If
sFilePath = sFolder & "\Software On-" & sComputer & ".xls"
Set oFile = oFS.CreateTextFile(sFilePath, True)
Set oWS = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2")
Set colSoftware = oWS.ExecQuery _
("Select * from Win32_Product")
oFile.WriteLine "Name" & vbtab & _
"Version" & vbtab & "Install Date" & vbtab & _
"Product Code" & vbtab & "Install Location" & vbtab & _
"Package Cache" & vbtab & "Caption" & vbtab & _
"Install State" & vbtab & "SKU Number" & vbtab & "Vendor" & vbtab _
& "Description"
For Each oSoftware in colSoftware
sDate = oSoftware.InstallDate2
If IsNull(sDate) Then
sDate = "No Install Date"
Else
sDate = CDateWMI(sDate)
End If
oFile.WriteLine oSoftware.Name & vbtab & _
oSoftware.Version & vbtab & _
sDate & vbtab & _
oSoftware.IdentifyingNumber & vbtab & _
oSoftware.InstallLocation & vbtab & _
oSoftware.PackageCache & vbtab & _
oSoftware.Caption & vbtab & _
oSoftware.InstallState & vbtab & _
oSoftware.SKUNumber & vbtab & _
oSoftware.Vendor & vbtab & _
oSoftware.Description
Next
oFile.Close
'Open the file in Excel and display results
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
Set oWorkBooks = oExcel.Workbooks.Open(sFilePath,,,,,,,,tab)
Set oWorksheet = oWorkBooks.Worksheets(1)
'Autofit entire worksheet range
Set oRange = oExcel.Range("A1:K1")
oRange.Font.Bold = True
oRange.Font.Background
Set oRange = oWorksheet.UsedRange
oRange.EntireColumn.Autofit()
'Sort data,include header row, and Align left
Set oRange2 = oExcel.Range("A1")
Set oRange = oWorksheet.UsedRange
oRange.Sort oRange2, , , , , , , xlYes
oRange.HorizontalAlignment = 2
'Horizontal Center allign first row (Left = 2,Center = 3, Right = 4)
Set oFirstRow = oExcel.Range("A1:K1")
With oFirstRow
.HorizontalAlignment = 3
End With
'Shade selection with Gray color
With oFirstRow.Interior
.ColorIndex = 15
End With
'Freeze panes on second row
Set oSecondRow = oExcel.Range("2:2").Select
oExcel.ActiveWindow.FreezePanes = True
Set oFirstCell = oExcel.Range("A1").Select
'========================================================================
'=============== FUNCTIONS ==============================================
'========================================================================
'Date Function by DH
Function CDateWMI(cim_DateTime)
Dim sDateTime, iYear, iMonth, iDay
sDateTime = CStr(cim_DateTime)
iYear = CInt(Mid(sDateTime, 1, 4))
iMonth = CInt(Mid(sDateTime, 5, 2))
iDay = CInt(Mid(sDateTime, 7, 2))
CDateWMI = CDate(Join(Array(iYear, iMonth, iDay), "/"))
End Function
'Time Function by DH
Function CTimeWMI(cim_DateTime)
Dim sDateTime, iHours, iMinutes, iSeconds
sDateTime = CStr(cim_DateTime)
iHours = CInt(Mid(sDateTime, 9, 2))
iMinutes= CInt(Mid(sDateTime, 11, 2))
iSeconds = CInt(Mid(sDateTime, 13, 2))
CTimeWMI = TimeSerial(iHours, iMinutes, iSeconds)
End Function
'Date-Time conversion UTC to Standard by DH
Function UTCtoStandard(CreationDate)
UTCtoStandard = CDate(Mid(CreationDate, 5, 2) & "/" & _
Mid(CreationDate, 7, 2) & "/" & Left(CreationDate, 4) _
& " " & Mid (CreationDate, 9, 2) & ":" & _
Mid(CreationDate, 11, 2) & ":" & Mid(CreationDate, _
13, 2))
End Function
|