Extracting Software Display Name and Display Version from a .reg file

Hey guys,

I need a tiny tool to help parse 2 strings from a .reg file  – should be fairly easy J

USE CASE

The script will open the .reg file  and for every Instance of:

“[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\”

Extract data from the following headers:

·      Display Name
·      Display Version

Present the output it in a comma deliminated or .xls output.

EXAMPLE

Sample input (sample.reg)
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\KB931906]
"DisplayName"="Security Update for CAPICOM (KB931906)"
"DisplayVersion"="2.1.0.2"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3C4DF0FD-95CF-4F7B-A816-97CEF616948F}]
"UninstallString"="\"C:\\Program Files\\InstallShield Installation Information\\{3C4DF0FD-95CF-4F7B-A816-97CEF616948F}\\setup.exe\""
"LogFile"="C:\\Program Files\\InstallShield Installation Information\\{3C4DF0FD-95CF-4F7B-A816-97CEF616948F}\\setup.ilg"
"InstallLocation"="C:\\hp\\"
"ProductGuid"="{3C4DF0FD-95CF-4F7B-A816-97CEF616948F}"
"InstallSource"="C:\\HP Mgmt\\sysmgmt\\Setup.exe"
"DisplayName"="HP System Management Homepage"
"Publisher"="Hewlett-Packard Company"
"URLInfoAbout"="http://www.hp.com"
"RegCompany"="Invenergy LLC"
"DisplayIcon"="C:\\hp\\hpsmh\\csIcon.ico"
"NoModify"=dword:00000001
"NoRemove"=dword:00000000
"NoRepair"=dword:00000001
"InstallDate"="20090514"
"Language"=dword:00000009
"DisplayVersion"="2.1.14"
"Version"=dword:0201000e
"MajorVersion"=dword:00000002
"MinorVersion"=dword:00000001
"LogMode"=dword:00000001

Sample output (sample.xls)

Software                                                Version
Security Update for CAPICOM                2.1.0.2
HP System Management Homepage      2.1.14



NanohurtzChromeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

merowingerCommented:
Please check the below listed script. It creates a csv file which can easily opened with excel
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile("D:\test.reg")
set objOutput = objFSO.CreateTextFile("D:\Output.csv")

Do while not objFile.AtEndOfStream
	strCurrentLine = objFile.ReadLine
	
	If Instr(strCurrentLine,"DisplayName") then
		strName = Replace(Split(strCurrentLine,"=")(1),chr(34),"")
	End if
	If Instr(strCurrentLine,"DisplayVersion") then
		strVersion = Replace(Split(strCurrentLine,"=")(1),chr(34),"")
		objOutput.WriteLine strName &";" &strVersion
	End if
Loop

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NanohurtzChromeAuthor Commented:
A credit to the title of "Guru" Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.