Jtracy_ItPro

Slack_x64-Detect_AllUsers.vbs

Sep 18th, 2020
1,630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Detect Slack x64 MSI Installer
  2. ' "Machine-wide" install - SYSTEM / "all users" style
  3.  
  4. ' I'm confused about other MSI "versions".
  5. ' This one is named something like "slack-standalone-4.9.0.0_x64.msi"
  6. ' The per-user version needs you to be admin and writes to  program files?
  7. ' Am I missing something here?
  8. ' -JT
  9.  
  10.  
  11. ' =-=-=-=-=-=
  12. ' let's call this 1.1? - JT
  13.  
  14. ' This is designed for a MEMCM detection rule
  15. ' If an app with a matching name is found, it will spit out the name.
  16. ' If not... there is no output.
  17. ' To narrow by architecture, you can exclude or include the appropriate hive.
  18.  
  19. ' This is meant to do exact matches.
  20. ' case sensitive
  21.  
  22. MyAppName = "Slack Machine-Wide"
  23.  
  24. HKEY_LOCAL_MACHINE = &H80000002
  25. HKEY_CURRENT_USER  = &H80000001
  26. UninstallNative = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
  27. UninstallWow32 = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
  28. ProductsNative = "Software\Microsoft\Installer\Products\"
  29. ProductsSystem = "SOFTWARE\Classes\Installer\Products\"
  30.  
  31. Set Reg = GetObject("winmgmts://./root/default:StdRegProv")
  32.  
  33. ' Define the function, to be repeated for each key base
  34.  
  35. Function FindApp (Hive, KeyBase)
  36.  
  37.     Reg.EnumKey Hive, KeyBase, Results
  38.  
  39. ' look for ProductName instead of displayname - JT
  40.  
  41.     For Each Key in Results
  42.         Reg.GetStringValue Hive, KeyBase & Key, "DisplayName", FoundAppName
  43.         If (FoundAppName = MyAppName) Then
  44.             wscript.echo FoundAppName
  45.         End If
  46.     Next
  47.  
  48. End Function
  49.  
  50. ' now run the function
  51. ' per user product search
  52.  
  53. FindApp HKEY_LOCAL_MACHINE, UninstallNative
  54.  
  55.  
Add Comment
Please, Sign In to add comment