From d47a750badb43077fe13ee87db4464302e14712b Mon Sep 17 00:00:00 2001
From: WindowsAddict <windowsaddict@protonmail.com>
Date: Tue, 6 May 2025 19:29:19 +0530
Subject: [PATCH] Detect Powershell 1.0 on Server 2008 and ask to install
 Powershell 2.0

---
 MAS/All-In-One-Version-KL/MAS_AIO.cmd         | 34 +++----------------
 .../Activators/Ohook_Activation_AIO.cmd       |  8 ++---
 .../Activators/Online_KMS_Activation.cmd      |  8 ++---
 .../Activators/TSforge_Activation.cmd         |  8 ++---
 .../Extract_OEM_Folder.cmd                    |  8 ++---
 MAS/Separate-Files-Version/Troubleshoot.cmd   |  8 ++---
 6 files changed, 24 insertions(+), 50 deletions(-)

diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd
index 17472aa..bd8d6aa 100644
--- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd
+++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd
@@ -153,15 +153,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
 goto dk_done
 )
 
-if not exist %ps% (
+if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
 %nceline%
+if not exist %ps% (
 echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
+)
+echo Install PowerShell 2.0 using the following URL.
 echo:
 echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
 goto dk_done
 )
 
@@ -2168,32 +2168,6 @@ for %%A in (%_act% %_rem%) do (if "%%A"=="1" set _unattended=1)
 
 ::========================================================================================================================================
 
-if %winbuild% LSS 6001 (
-%nceline%
-echo Unsupported OS version detected [%winbuild%].
-echo MAS only supports Windows Vista/7/8/8.1/10/11 and their Server equivalents.
-if %winbuild% EQU 6000 (
-echo:
-echo Windows Vista RTM is not supported because Powershell cannot be installed.
-echo Upgrade to Windows Vista SP1 or SP2.
-)
-goto dk_done
-)
-
-if not exist %ps% (
-%nceline%
-echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
-echo:
-echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
-goto dk_done
-)
-
-::========================================================================================================================================
-
 if %_rem%==1 goto :oh_uninstall
 
 :oh_menu
diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
index 786d239..fd9d75c 100644
--- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
+++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd
@@ -183,15 +183,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
 goto dk_done
 )
 
-if not exist %ps% (
+if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
 %nceline%
+if not exist %ps% (
 echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
+)
+echo Install PowerShell 2.0 using the following URL.
 echo:
 echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
 goto dk_done
 )
 
diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
index bd6446e..646818b 100644
--- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
+++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd
@@ -214,15 +214,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
 goto dk_done
 )
 
-if not exist %ps% (
+if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
 %nceline%
+if not exist %ps% (
 echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
+)
+echo Install PowerShell 2.0 using the following URL.
 echo:
 echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
 goto dk_done
 )
 
diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
index e85078b..3a905c7 100644
--- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
+++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd
@@ -220,15 +220,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
 goto dk_done
 )
 
-if not exist %ps% (
+if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
 %nceline%
+if not exist %ps% (
 echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
+)
+echo Install PowerShell 2.0 using the following URL.
 echo:
 echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
 goto dk_done
 )
 
diff --git a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd
index 7f6eb25..cd5e205 100644
--- a/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd
+++ b/MAS/Separate-Files-Version/Extract_OEM_Folder.cmd
@@ -144,15 +144,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
 goto done2
 )
 
-if not exist %ps% (
+if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
 %nceline%
+if not exist %ps% (
 echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
+)
+echo Install PowerShell 2.0 using the following URL.
 echo:
 echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
 goto done2
 )
 
diff --git a/MAS/Separate-Files-Version/Troubleshoot.cmd b/MAS/Separate-Files-Version/Troubleshoot.cmd
index 9106452..35768a8 100644
--- a/MAS/Separate-Files-Version/Troubleshoot.cmd
+++ b/MAS/Separate-Files-Version/Troubleshoot.cmd
@@ -145,15 +145,15 @@ echo Upgrade to Windows Vista SP1 or SP2.
 goto dk_done
 )
 
-if not exist %ps% (
+if %winbuild% LSS 7600 if not exist "%SysPath%\WindowsPowerShell\v1.0\Modules" (
 %nceline%
+if not exist %ps% (
 echo PowerShell is not installed in your system.
-if %winbuild% LSS 7600 (
-echo Install PowerShell using the following URL.
+)
+echo Install PowerShell 2.0 using the following URL.
 echo:
 echo https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
 if %_unattended%==0 start https://www.catalog.update.microsoft.com/Search.aspx?q=KB968930
-)
 goto dk_done
 )