WMI: Output to a file - TechRepublic
General discussion
April 21, 2005 at 11:48 AM
psvoboda

WMI: Output to a file

by psvoboda . Updated 21 years, 2 months ago

HI, Does anyone knows how to output the data to a file in the script below? I tried to find info on this but so far no luck. Thanks.
————————————-
Option Explicit

Dim strComputer, strKey, strSubKey
Dim objRegistry
Dim arrSubKeys()
Dim strDisplayName, strDisplayVersion, strInstallLocation

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = “.”
strKey = “SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”

‘*
‘* CALLOUT A
‘*
Set objRegistry = GetObject(“winmgmts:” & _
“{impersonationLevel=Impersonate}!\\” & _
strComputer & “\root\default:StdRegProv”)

‘*
‘* CALLOUT B
‘*
objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKey, arrSubKeys

‘*
‘* CALLOUT C
‘*
On Error Resume Next
For Each strSubKey In arrSubKeys

objRegistry.GetStringValue HKEY_LOCAL_MACHINE, _
strKey & “\” & strSubKey, _
“DisplayName”, _
strDisplayName

objRegistry.GetStringValue HKEY_LOCAL_MACHINE, _
strKey & “\” & strSubKey, _
“DisplayVersion”, _
strDisplayVersion

objRegistry.GetStringValue HKEY_LOCAL_MACHINE, _
strKey & “\” & strSubKey, _
“InstallLocation”, _
strInstallLocation

WScript.Echo strSubKey
WScript.Echo String(Len(strSubKey), “-“)
WScript.Echo “Display name: ” & strDisplayName
WScript.Echo “Display version: ” & strDisplayVersion
WScript.Echo “Install location: ” & strInstallLocation
WScript.Echo

strDisplayName = vbEmpty
strDisplayVersion = vbEmpty
strInstallLocation = vbEmpty

Next

This discussion is locked

All Comments