-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.vbs
90 lines (66 loc) · 2.52 KB
/
status.vbs
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Option Explicit
Dim resultsFile, fso, shell, result
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
Function IsFolderInstalledByRegistry(folderSubstring)
On Error Resume Next
Dim objRegistry, arrSubKeys, subkeyName, folderExists
folderExists = False
' Create a WMI object to access the registry
Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
' Define the registry hive and the fixed path to search
Dim hive, path
hive = &H80000001 ' HKEY_CURRENT_USER
path = "Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages\" ' Replace "ExamplePath" with your actual path
' Enumerate the subkeys under the specified path
objRegistry.EnumKey hive, path, arrSubKeys
' Check each subkey to see if it matches the folder substring
If Not IsNull(arrSubKeys) Then
For Each subkeyName In arrSubKeys
If InStr(1, subkeyName, folderSubstring, vbTextCompare) > 0 Then
folderExists = True
Exit For
End If
Next
End If
' Return whether the folder with the substring exists or not
IsFolderInstalledByRegistry = folderExists
' Clean up
Set objRegistry = Nothing
On Error GoTo 0
End Function
Function IsInstalledByRegistry(regPath)
On Error Resume Next
Dim installed
installed = shell.RegRead(regPath)
If Err.Number = 0 Then
IsInstalledByRegistry = True
Else
IsInstalledByRegistry = False
End If
On Error GoTo 0
End Function
Dim whatsappInstalled
whatsappInstalled = IsFolderInstalledByRegistry("WhatsAppDesktop")
Dim teamsInstalled
teamsInstalled = IsFolderInstalledByRegistry("MSTeams")
Dim discordRegPath, stremioRegPath
discordRegPath = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Discord\DisplayName"
stremioRegPath = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Stremio\DisplayName"
Dim discordInstalled, stremioInstalled
discordInstalled = IsInstalledByRegistry(discordRegPath)
stremioInstalled = IsInstalledByRegistry(stremioRegPath)
result = whatsappInstalled & vbCrLf
result = result & discordInstalled & vbCrLf
result = result & teamsInstalled & vbCrLf
result = result & stremioInstalled & vbCrLf
Dim outputFile
Set outputFile = fso.CreateTextFile("status.txt", True)
outputFile.WriteLine(result)
outputFile.WriteLine("")
outputFile.WriteLine("Unkown")
outputFile.Close
' Cleanup
Set fso = Nothing
Set shell = Nothing
Set outputFile = Nothing