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

Re: Enumerate Software Script **Help** by Torgeir

Torgeir
Mon Feb 09 16:34:37 CST 2004

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



Re: Enumerate Software Script **Help** by JC

JC
Mon Feb 09 16:42:38 CST 2004

Beautiful works awesome thank you so much!!!!


"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:40280AFD.7BA89056@hydro.com...
> 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
>
>