Hallo,
Ik heb hier een VBScript. Het laat zien in een txt-bestand welke programma's zijn geïnstalleerd op een machine met naam en versienummer. Ik wil graag programma's door dit script laten filteren, zodat deze programma's niet te zien zijn in het txt-bestand. Dus als voorbeeld Microsoft Word 2013 en Microsoft Excel 2013.
Zou iemand mij kunnen helpen? Onderstaand het script.
Ik heb hier een VBScript. Het laat zien in een txt-bestand welke programma's zijn geïnstalleerd op een machine met naam en versienummer. Ik wil graag programma's door dit script laten filteren, zodat deze programma's niet te zien zijn in het txt-bestand. Dus als voorbeeld Microsoft Word 2013 en Microsoft Excel 2013.
Zou iemand mij kunnen helpen? Onderstaand het script.
VBScript:
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
67
68
69
70
71
72
73
| 'listapps.vbs 'Generates a text file listing all 32bit & 64bit apps installed on the local machine '=================================================================================== 'Declare constants, variables and arrays '--------------------------------------- 'Registry keys and values Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE Dim arrKeys(1) arrKeys(0) = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" arrKeys(1) = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\" strComputer = "." strEntry1a = "DisplayName" strEntry1b = "QuietDisplayName" strEntry2 = "Publisher" strEntry3 = "InstallDate" strEntry4 = "EstimatedSize" strEntry5 = "DisplayVersion" 'Create the output file Dim objShell, objShellEnv, strComputerName, objFso Set objShell = WScript.CreateObject("WScript.Shell") Set objShellEnv = objShell.Environment("Process") strComputerName = objShellEnv("ComputerName") Set objFso = WScript.CreateObject("Scripting.FileSystemObject") Set outputFile = objFso.CreateTextFile(strComputerName & ".txt", True) '=================================================================================== Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv") 'Print header (comment out the line below if you do not want headers in your output file) 'outputFile.WriteLine"Name" & vbTab & "Publisher" & vbTab & "Installed On" & vbTab & "Size" & vbTab & "Version" & VbCrLf For i = 0 to 1 'Check to ensure registry key exists intCheckKey = objReg.EnumKey(HKLM, arrKeys(i), arrSubkeys) If intCheckKey = 0 Then For Each strSubkey In arrSubkeys intReturn = objReg.GetStringValue(HKLM, arrKeys(i) & strSubkey, strEntry1a, strValue1) If intReturn <> 0 Then objReg.GetStringValue HKLM, arrKeys(i) & strSubkey, strEntry1b, strValue1 End If objReg.GetStringValue HKLM, arrKeys(i) & strSubkey, strEntry2, strValue2 objReg.GetStringValue HKLM, arrKeys(i) & strSubkey, strEntry3, strValue3 objReg.GetDWORDValue HKLM, arrKeys(i) & strSubkey, strEntry4, strValue4 objReg.GetStringValue HKLM, arrKeys(i) & strSubkey, strEntry5, strValue5 If strValue1 <> "" Then outputFile.WriteLine strValue1 & vbTab & strValue2 & vbTab & strValue3 & vbTab & strValue4 & vbTab & strValue5 End If Next End If Next 'Close the output file outputFile.Close 'Launch output file for review objShell.run "notepad.exe " & strComputerName & ".txt" 'Clean up and exit Set objShell = Nothing Set objFso = Nothing |