Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Output values from Enumerated reg keys

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,60567
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Output values from Enumerated reg keys
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Output values from Enumerated reg keys - 5/21/2008 7:07:55 PM   
  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


 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Output values from Enumerated reg keys Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts