Option Explicit
On Error Resume Next

' === Fix Error 1625: Disable Windows Installer restriction policy ===
' This removes the Group Policy that blocks MSI installations
' Must run as admin

Dim WshShell
Set WshShell = CreateObject("WScript.Shell")

' Method 1: Set DisableMSI = 0 (allow all MSI installs)
WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\Installer\DisableMSI", 0, "REG_DWORD"

' Method 2: Enable "Always install with elevated privileges"
WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\Installer\AlwaysInstallElevated", 1, "REG_DWORD"
WshShell.RegWrite "HKCU\Software\Policies\Microsoft\Windows\Installer\AlwaysInstallElevated", 1, "REG_DWORD"

' Method 3: Disable Software Restriction on MSI
WshShell.RegWrite "HKLM\Software\Policies\Microsoft\Windows\Installer\DisableUserInstalls", 0, "REG_DWORD"

' Restart Windows Installer service to apply
WshShell.Run "cmd /c net stop msiserver & net start msiserver", 0, True

MsgBox "Done! MSI policy restriction removed." & vbCrLf & "Now run B_6_test.vbs again.", 64, "Fix 1625"
WScript.Quit 0
