11@ echo off
2+ title DeployWorkstation Launcher v5.1
23REM ========================================================
3- REM DeployWorkstation.bat
4- REM Launcher for DeployWorkstation.ps1
4+ REM DeployWorkstation.bat - Launcher for DeployWorkstation.ps1
55REM Version 5.1 - PNWC Edition
66REM ========================================================
77
@@ -12,37 +12,40 @@ echo ===== DeployWorkstation Launcher v5.1 =====
1212echo .
1313
1414REM --------------------------------------------------------
15- REM 1) Elevation check - re-launch elevated if not admin
15+ REM Elevation check - re-launch elevated if not admin
1616REM --------------------------------------------------------
1717net session > nul 2 >& 1
1818if %errorlevel% neq 0 (
1919 echo Requesting administrative privileges...
20- echo Please click " Yes " in the UAC prompt.
20+ echo Please accept the UAC prompt.
2121 echo .
22- powershell.exe -NoProfile -Command " Start-Process -FilePath ' %~f0 ' -Verb RunAs -Wait "
23- exit /b
22+ powershell.exe -NoProfile -Command " Start-Process cmd.exe -ArgumentList '/c " %~f0 " ' -Verb RunAs"
23+ exit /b 0
2424)
2525
2626echo [OK] Running as Administrator.
2727echo .
2828
2929REM --------------------------------------------------------
30- REM 2) Change to the directory containing this .bat
30+ REM Change to the directory containing this .bat
3131REM --------------------------------------------------------
3232pushd " %~dp0 "
3333
3434REM --------------------------------------------------------
35- REM 3) Verify the PowerShell script is present
35+ REM Verify the PowerShell script is present
3636REM --------------------------------------------------------
3737if not exist " DeployWorkstation.ps1" (
38- echo [ERROR] DeployWorkstation.ps1 not found.
39- echo Expected: %~dp0 DeployWorkstation.ps1
38+ echo [ERROR] DeployWorkstation.ps1 not found in:
39+ echo %~dp0
4040 echo .
41+ echo Both files must be in the same folder.
42+ echo .
43+ pause
4144 goto :error_exit
4245)
4346
4447REM --------------------------------------------------------
45- REM 4) Menu
48+ REM Menu
4649REM --------------------------------------------------------
4750:menu
4851echo Select deployment mode:
@@ -83,7 +86,7 @@ if "%choice%"=="1" (
8386)
8487
8588REM --------------------------------------------------------
86- REM 5) Show parameters then launch
89+ REM Launch
8790REM --------------------------------------------------------
8891if " !ps_params! " == " " (
8992 echo Parameters : (none - full run)
@@ -100,32 +103,26 @@ if "!ps_params!"=="" (
100103 powershell.exe -NoProfile -ExecutionPolicy Bypass -File " DeployWorkstation.ps1" !ps_params!
101104)
102105
103- REM Capture exit code immediately before anything can overwrite it
104106set " ps_exit = %errorlevel% "
105107
106- REM --------------------------------------------------------
107- REM 6) Result
108- REM --------------------------------------------------------
109108echo .
110109if " %ps_exit% " == " 0" (
111110 echo ===== Deployment completed successfully =====
112111) else (
113112 echo ===== Deployment finished with errors =====
114- echo Exit code : %ps_exit%
115- echo Check DeployWorkstation.log in this folder for details.
113+ echo Exit code : %ps_exit%
114+ echo Log file : %~dp0 DeployWorkstation.log
116115)
117116
118117goto :normal_exit
119118
120- REM --------------------------------------------------------
121119:error_exit
122120echo .
123121echo ===== Launch aborted =====
124122popd
125123pause
126124exit /b 1
127125
128- REM --------------------------------------------------------
129126:normal_exit
130127popd
131128echo .
0 commit comments