| |
glwday
Posts: 1
Score: 0
Joined: 5/21/2008
Status: offline
|
Hi We have a project to upgrade several hundred pc's and want to build a record of the apps installed on each pc. The software was deployed using psexec and creates a registry key under HKLM\Software\CSC\Packages for each app installed. There will be a string value under each app "Installed" with a value of Yes or No determining whether the software is currently installed. I am new to vbscript and have found a script which I have been trying to modify. The script should output only those apps where the String value Installed has a data value of Yes (mixed case if that is important?) At the moment it outputs all apps i.e where Installed is Yes or No and I can't work out why. Any help gratefully recvd. Gary Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 Const Create = True Const NoCreate = False Const HKEY_LOCAL_MACHINE = &H80000002 Dim strKeyPath : strKeyPath = "Software\CSC\Packages" Dim strValueName : strValueName = "Installed" Dim strAppList, strApp, strAppInstalled strListFile="pclist.txt" intRow = 2 Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Machine Name" objExcel.Cells(1, 2).Value = "Application Name" Set oFSO = CreateObject("Scripting.FileSystemObject") Set oListFile = oFSO.OpenTextFile(strListFile, ForReading, NoCreate) Do While Not (oListFile.atEndOfStream) strComputer = oListFile.ReadLine objExcel.Cells(intRow, 1).Value = UCase(strComputer) Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, strAppList For Each strApp In strAppList result = oReg.GetExpandedStringValue(HKEY_LOCAL_MACHINE, strKeyPath, strApp, strValueName, strAppInstalled) If strAppInstalled = Yes Then objExcel.Cells(intRow, 2).Value = strApp End If intRow = intRow + 1 Next Loop oListFile.Close objExcel.Range("A1:B1").Select objExcel.Selection.Interior.ColorIndex = 36 objExcel.Selection.Font.Bold = True objExcel.Cells.EntireColumn.AutoFit
|
|