-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeployWorkstation.bat
More file actions
132 lines (105 loc) · 2.97 KB
/
DeployWorkstation.bat
File metadata and controls
132 lines (105 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@echo off
title DeployWorkstation Launcher v5.1
REM ========================================================
REM DeployWorkstation.bat - Launcher for DeployWorkstation.ps1
REM Version 5.1 - PNWC Edition 4.1.2026
REM ========================================================
setlocal enabledelayedexpansion
echo.
echo ===== DeployWorkstation Launcher v5.1 =====
echo.
REM 1) Check if we're already elevated
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Requesting administrative privileges...
echo Please accept the UAC prompt.
echo.
powershell.exe -NoProfile -Command "Start-Process cmd.exe -ArgumentList '/c "%~f0"' -Verb RunAs"
exit /b 0
)
echo [OK] Running as Administrator.
echo.
REM --------------------------------------------------------
REM Change to the directory containing this .bat
REM --------------------------------------------------------
pushd "%~dp0"
REM 4) Check if PowerShell script exists
if not exist "DeployWorkstation.ps1" (
echo [ERROR] DeployWorkstation.ps1 not found in:
echo %~dp0
echo.
echo Both files must be in the same folder.
echo.
pause
goto :error_exit
)
REM 5) Show options menu
echo Available options:
echo 1. Full deployment (remove bloatware + install apps)
echo 2. Remove bloatware only
echo 3. Install apps only
echo 4. Exit
echo.
set "choice="
set /p choice="Enter choice (1-5): "
REM 6) Set PowerShell parameters based on choice
set "ps_params="
if "%choice%"=="1" (
echo Running full deployment...
set "ps_params="
) else if "%choice%"=="2" (
echo Running bloatware removal only...
set "ps_params=-SkipAppInstall"
) else if "%choice%"=="3" (
echo Running app installation only...
set "ps_params=-SkipBloatwareRemoval"
) else if "%choice%"=="4" (
echo.
echo [*] System configuration only.
set "ps_params=-SkipBloatwareRemoval -SkipAppInstall"
) else if "%choice%"=="5" (
echo Exiting.
goto :normal_exit
) else (
echo [!] Invalid choice - please try again.
echo.
goto :menu
)
REM --------------------------------------------------------
REM Launch
REM --------------------------------------------------------
if "!ps_params!"=="" (
echo Parameters : (none - full run)
) else (
echo Parameters : !ps_params!
)
echo.
echo Starting Windows PowerShell 5.1...
echo.
if "!ps_params!"=="" (
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "DeployWorkstation.ps1"
) else (
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "DeployWorkstation.ps1" !ps_params!
)
REM 8) Check exit code and report results
if %errorlevel% equ 0 (
echo.
echo ===== Deployment completed successfully =====
) else (
echo ===== Deployment finished with errors =====
echo Exit code : %ps_exit%
echo Log file : %~dp0DeployWorkstation.log
)
goto :normal_exit
:error_exit
echo.
echo ===== Launch aborted =====
popd
pause
exit /b 1
:normal_exit
popd
echo.
echo Press any key to close...
pause >nul
exit /b 0