PDA

View Full Version : Listing installed programs (W2K)



brashquido
12-17-2002, 08:23 PM
Hi All,

I work for a small company and have been charged with doing a basic software audit. I was wondering if anyone knows of a command line tool that is able to extract a list of all programs and version? Any help would be great, thanks!

mysterywolf
12-18-2002, 03:44 AM
first of all on your own pc search for msinfo32. then open a dos window. rt-click msinfo32 and drag into the dos window. this should create the path to it for you easier than typing it all in! at the end of that line put a space then type /? and enter you should get a list of switches. by running msinfo32 itself you can get an idea of what those switches need to be for your purpose.
would suggest running msinfo32 from a network location would give you a standard method along with directing output to a files - again in a central network location.

...although i'm sure this info could be got by looking at a bit of registry allowing an export to be easily done or even for you to get it remotely- and some kind person might be ablke to post that for you!.

Andy-S
12-18-2002, 07:00 AM
Here's a script from the script guru on this site (Jama).

This will enumerate the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uni nstall key in the registry and log the software installed.

'=============== Section 1 Start ==================
'This part of the script creates the the text File.
'If you don't want to create the text file, delete
'this section as will as the third section, then change
' evry instance of "tf.WriteLine" to "Wscript.echo".


ReportFile = "c:\Installed Apps -Registry.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set tf = fso.CreateTextFile(ReportFile, True)
'================ Section 1 eNd ===================

'This section demonstrates the power of WMI when
'combined with WSH.
'=============== Section 2 Start ==================
strComputer = "."
Const HKEY_LOCAL_MACHINE = &H80000002

Set oReg = GetObject("winmgmts:" & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstal l"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
On Error Resume Next
strKey = "HKLM\" & strKeyPath & "\" & subkey
tf.WriteLine "Key = " & strKey
tf.WriteLine "Name: " & WshShell.RegRead(strKey & "\DisplayName")
tf.WriteLine "Version: " & WshShell.RegRead(strKey & "\DisplayVersion")
tf.WriteLine "Publisher: " & WshShell.RegRead(strKey & "\Publisher")
tf.WriteLine String(30, "=")
tf.WriteBlankLines(2)
Next
'================ Section 2 eNd ===================

'=============== Section 3 Start ==================
tf.Close
WshShell.run "Notepad.exe" & " " & ReportFile, 1, False

Set fso = Nothing
Set WshShell = Nothing
Set tf = Nothing
Set oReg = Nothing
'================ Section 3 eNd ===================


Cheers
Andy

Andy-S
12-18-2002, 09:03 AM
Sorry, I should have added:

To create the script, copy the contents from start of section1 to end of section 3 to notepad and save the file as "myscript".vbs where myscript is your script name. Just double click on the file to execute it or add it to a batch file to run automatically.

Cheers
Andy

brashquido
12-18-2002, 01:52 PM
Thanks all :D !!

Hey Andy, that script is spot on the mark, thanks a bundle :D !

One last thing. I was thinking of including the script in the NT login scripts to automate the audit as much as possible (because the company spreads 4 different countries and 4 different time zones). Is there anyway I can get the report file to output to a txt file with the name of the machine that was audited (e.g workstation1 = workstation1.txt)?

I tried changing the output file to goto a network share and output to a file called %computername%.txt but I have no idea what I'm doing with VBS and it obviously doesn't recognise variables in that way.

Any help again will be much appreciated :)

Jama
12-18-2002, 09:58 PM
<blockquote><font class="small">In reply to:</font><hr>

Here's a script from the script guru on this site (Jama)

<hr></blockquote>
They should outlaw comments like that, it makes people’s heads bigger /images/forums/icons/smile.gif
Thanks Andy.

brashquido, here’s a modified script that will do what you want. Just give it the full path to the network share and modify the FileName (optional).


'----------------------- Script begin ----------------------------
'==================== User Changeable Variables ==================
' Full path to the network share
ReportsFolder = "\\meshxp\c$\Installed Apps"

'A report file will be created by each computer in the network share.
'The remote computer’s name will form the first part of the file’s name
'followed by what you assigne to FileName. AS in "Server1_Installed Apps.txt"
FileName = "_Installed Apps.txt"
'============== eNd of User Changeable Variables ================

Set fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WSHNetwork = WScript.CreateObject("WScript.Network")
FileName = ReportsFolder & "\" & WSHNetwork.ComputerName &_
"_Installed Apps.txt"
Set tf = fso.CreateTextFile(FileName, True)


strComputer = "."
Const HKEY_LOCAL_MACHINE = &H80000002
Set oReg = GetObject("winmgmts:" & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstal l"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
On Error Resume Next
strKey = "HKLM\" & strKeyPath & "\" & subkey
tf.WriteLine "Key = " & strKey
tf.WriteLine "Name: " & WshShell.RegRead(strKey & "\DisplayName")
tf.WriteLine "Version: " & WshShell.RegRead(strKey & "\DisplayVersion")
tf.WriteLine "Publisher: " & WshShell.RegRead(strKey & "\Publisher")
tf.WriteLine String(30, "=")
tf.WriteBlankLines(2)
Next

tf.Close

Set fso = Nothing
Set WshShell = Nothing
Set WSHNetwork = Nothing
Set tf = Nothing
Set oReg = Nothing
'------------------------- Script eNd -------------------------

Jama

Andy-S
12-19-2002, 06:59 AM
Jama,

Got to give credit where it's due. I'm always impressed with your responses on this forum. You are the <font color=blue>GURU</font color=blue>. Your head must be getting bigger and bigger /images/forums/icons/smile.gif.

Cheers
Andy