1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| Set fso = CreateObject("Scripting.FileSystemObject")
Set Ts1 = fso.OpenTextFile("C:\Users\mhn1\Documents\nomsrv.txt")
Set Ts2 = fso.CreateTextFile("C:\Users\mhn1\Documents\listeapplication.txt", True)
while not ts1.AtEndOfStream
Strcomputer=ts1.ReadLine
Const HKLM = &h80000002
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 32
objCtx.Add "__RequiredArchitecture", TRUE
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objStdRegProv = objServices.Get("StdRegProv")
Ts2.WriteLine "32-bit Applications"
Ts2.WriteLine "-------------------"
Call GetApplications
objCtx.Add "__ProviderArchitecture", 64
objCtx.Add "__RequiredArchitecture", TRUE
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objStdRegProv = objServices.Get("StdRegProv")
Ts2.WriteLine "64-bit Applications"
Ts2.WriteLine "-------------------"
On Error resume next
Call GetApplications
Sub GetApplications
' Use ExecMethod to call the GetStringValue method
Set Inparams = objStdRegProv.Methods_("EnumKey").Inparameters
Inparams.Hdefkey = HKLM
Inparams.Ssubkeyname = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
set Outparams = objStdRegProv.ExecMethod_("EnumKey", Inparams,,objCtx)
For Each strSubKey In Outparams.snames
Set Inparams = objStdRegProv.Methods_("GetStringValue").Inparameters
Inparams.Hdefkey = HKLM
Inparams.Ssubkeyname = "Software\Microsoft\Windows\CurrentVersion\Uninstall\" & strSubKey
Inparams.Svaluename = "DisplayName"
set Outparams = objStdRegProv.ExecMethod_("GetStringValue", Inparams,,objCtx)
if ("" & Outparams.sValue) = "" then
Ts2.WriteLine strSubKey
Else
Ts2.WriteLine Outparams.SValue
End iF
Inparams.Svaluename = "QuietDisplayName"
set Outparams = objStdRegProv.ExecMethod_("GetStringValue", Inparams,,objCtx)
Ts2.WriteLine "Outparams.SValue"
Next
End Sub |
Partager