Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enumerate Software Script **Help**

244 views
Skip to first unread message

JC

unread,
Feb 9, 2004, 5:03:16 PM2/9/04
to
I found this script on the web and it works awesome, however it is above my
knowledge of VBS. What I need it to do instead of displaying each software
installed I would like to simply output it to a flat text file, can anyone
help?

Thanks in advanced..

On Error Resume Next
sComputer = "."
MsgBox InstalledApplications(sComputer)
Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
node & "/root/default:StdRegProv")
sBaseKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
iRC = oRegistry.GetStringValue(HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oRegistry.GetStringValue HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
InstalledApplications = InstalledApplications & sValue & vbCrLf
End If
Next
End Function


Torgeir Bakken (MVP)

unread,
Feb 9, 2004, 5:34:37 PM2/9/04
to
JC wrote:

> I found this script on the web and it works awesome, however it is above my
> knowledge of VBS. What I need it to do instead of displaying each software
> installed I would like to simply output it to a flat text file, can anyone
> help?

> (snip)

Hi

Here you go:


Const OpenAsASCII = 0 ' Opens the file as ASCII (TristateFalse)
Const OverwriteIfExist = -1

' file where result is to be saved
sFile = "c:\apps.txt"

sComputer = "." ' use . for local computer

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set fFile = oFSO.CreateTextFile(sFile, _
OverwriteIfExist, OpenAsASCII)

fFile.Write InstalledApplications(sComputer)
fFile.Close


Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE

Set oRegistry = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _


& node & "/root/default:StdRegProv")

sBaseKey = _


"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys

iRC = oRegistry.GetStringValue( _


HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then

oRegistry.GetStringValue _


HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then

InstalledApplications = _


InstalledApplications & sValue & vbCrLf
End If
Next
End Function

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


JC

unread,
Feb 9, 2004, 5:42:38 PM2/9/04
to
Beautiful works awesome thank you so much!!!!


"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:40280AFD...@hydro.com...

0 new messages