Skip to content

Commit 399fdc9

Browse files
authored
Change launcher version and enhance error messages
Updated the launcher version from 6.0 to 5.1 and improved error handling messages.
1 parent b9cc461 commit 399fdc9

1 file changed

Lines changed: 100 additions & 14 deletions

File tree

DeployWorkstation.bat

Lines changed: 100 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,131 @@
11
@echo off
2+
REM ========================================================
3+
REM DeployWorkstation.bat
4+
REM Launcher for DeployWorkstation.ps1
5+
REM Version 5.1 – PNWC Edition (fixed)
6+
REM ========================================================
7+
28
setlocal EnableExtensions EnableDelayedExpansion
39

410
echo.
5-
echo ===== DeployWorkstation Launcher v6.0 =====
11+
echo ===== DeployWorkstation Launcher v5.1 =====
612
echo.
713

8-
rem Relaunch elevated if needed
14+
REM --------------------------------------------------------
15+
REM 1) Elevation check
16+
REM --------------------------------------------------------
917
net session >nul 2>&1
1018
if errorlevel 1 (
1119
echo Requesting administrative privileges...
20+
echo Please click "Yes" in the UAC prompt.
21+
echo.
1222
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
1323
"Start-Process -FilePath '%~f0' -Verb RunAs"
1424
exit /b
1525
)
1626

17-
pushd "%~dp0" || (
18-
echo [ERROR] Could not access script folder.
19-
pause
20-
exit /b 1
27+
echo [OK] Running as Administrator.
28+
echo.
29+
30+
REM --------------------------------------------------------
31+
REM 2) Change to the directory containing this .bat
32+
REM --------------------------------------------------------
33+
pushd "%~dp0"
34+
if errorlevel 1 (
35+
echo [ERROR] Failed to access script folder.
36+
goto :error_exit
2137
)
2238

39+
REM --------------------------------------------------------
40+
REM 3) Verify the PowerShell script is present
41+
REM --------------------------------------------------------
2342
if not exist "%~dp0DeployWorkstation.ps1" (
2443
echo [ERROR] DeployWorkstation.ps1 not found.
25-
echo Expected: %~dp0DeployWorkstation.ps1
26-
set "ps_exit=1"
27-
goto :done
44+
echo Expected: %~dp0DeployWorkstation.ps1
45+
echo.
46+
goto :error_exit
47+
)
48+
49+
REM --------------------------------------------------------
50+
REM 4) Menu
51+
REM --------------------------------------------------------
52+
:menu
53+
echo Select deployment mode:
54+
echo.
55+
echo 1. Full deployment (remove bloatware + install apps + configure system)
56+
echo 2. Remove bloatware only
57+
echo 3. Install apps only
58+
echo 4. System configuration only
59+
echo 5. Exit
60+
echo.
61+
set "choice="
62+
set /p "choice=Enter choice (1-5): "
63+
64+
set "ps_params="
65+
66+
if "%choice%"=="1" (
67+
echo.
68+
echo [*] Full deployment selected.
69+
) else if "%choice%"=="2" (
70+
echo.
71+
echo [*] Bloatware removal only.
72+
set "ps_params=-SkipAppInstall -SkipSystemConfig"
73+
) else if "%choice%"=="3" (
74+
echo.
75+
echo [*] App installation only.
76+
set "ps_params=-SkipBloatwareRemoval -SkipSystemConfig"
77+
) else if "%choice%"=="4" (
78+
echo.
79+
echo [*] System configuration only.
80+
set "ps_params=-SkipBloatwareRemoval -SkipAppInstall"
81+
) else if "%choice%"=="5" (
82+
set "ps_exit=0"
83+
goto :normal_exit
84+
) else (
85+
echo [!] Invalid choice - please try again.
86+
echo.
87+
goto :menu
2888
)
2989

30-
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%~dp0DeployWorkstation.ps1"
90+
REM --------------------------------------------------------
91+
REM 5) Show what will run, then launch
92+
REM --------------------------------------------------------
93+
if defined ps_params (
94+
echo Parameters : !ps_params!
95+
) else (
96+
echo Parameters : (none - full run)
97+
)
98+
echo.
99+
echo Starting Windows PowerShell 5.1...
100+
echo.
101+
102+
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%~dp0DeployWorkstation.ps1" !ps_params!
103+
104+
REM Capture exit code immediately
31105
set "ps_exit=%errorlevel%"
32106

107+
REM --------------------------------------------------------
108+
REM 6) Result
109+
REM --------------------------------------------------------
33110
echo.
34111
if "%ps_exit%"=="0" (
35112
echo ===== Deployment completed successfully =====
36113
) else (
37-
echo ===== Deployment completed with warnings or errors =====
38-
echo Exit code: %ps_exit%
39-
echo Review DeployWorkstation.log and DeployWorkstation.html in this folder.
114+
echo ===== Deployment finished with errors =====
115+
echo Exit code : %ps_exit%
116+
echo Check DeployWorkstation.log in this folder for details.
40117
)
41118

42-
:done
119+
goto :normal_exit
120+
121+
REM --------------------------------------------------------
122+
:error_exit
123+
echo.
124+
echo ===== Launch aborted =====
125+
set "ps_exit=1"
126+
127+
REM --------------------------------------------------------
128+
:normal_exit
43129
popd
44130
echo.
45131
echo Press any key to close...

0 commit comments

Comments
 (0)