Skip to content

Commit 2f13f03

Browse files
authored
Implement script integrity verification
Added integrity verification for DeployWorkstation.ps1.
1 parent f79b6ef commit 2f13f03

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

DeployWorkstation.bat

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ if "!ps_params!"=="" (
9393
echo Parameters : !ps_params!
9494
)
9595
echo.
96+
echo Verifying script integrity...
97+
REM Pass path via env var so PS resolves it — avoids CMD delayed-expansion
98+
REM mangling of '!' characters in folder names (e.g. Deploy!v5.1\).
99+
set "DEPLOY_PS1=%~dp0DeployWorkstation.ps1"
100+
powershell.exe -NoProfile -Command ^
101+
"$p=$env:DEPLOY_PS1;$null=[System.Management.Automation.Language.Parser]::ParseFile($p,[ref]$null,[ref]$e);if($e){$e|ForEach-Object{Write-Host('SYNTAX ERROR: '+$_.Message)};exit 1}"
102+
set "DEPLOY_PS1="
103+
if %errorlevel% neq 0 (
104+
echo.
105+
echo [ERROR] DeployWorkstation.ps1 has syntax errors - please re-download.
106+
echo.
107+
pause
108+
goto :error_exit
109+
)
110+
96111
echo Starting Windows PowerShell 5.1...
97112
echo.
98113

@@ -131,6 +146,5 @@ REM --------------------------------------------------------
131146
:normal_exit
132147
popd
133148
echo.
134-
echo Press any key to close...
135-
pause >nul
149+
pause
136150
exit /b 0

0 commit comments

Comments
 (0)