@echo off REM ============================================================================ REM Test-RemotePC-Debug.bat REM Runs WinRM HTTPS debug test with execution policy bypass REM ============================================================================ REM Setup logging set "LOG_DIR=S:\DT\ADATA\SCRIPT\DEPLOY\LOGS" set "HOSTNAME=%COMPUTERNAME%" set "TIMESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%-%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%" set "TIMESTAMP=%TIMESTAMP: =0%" set "LOG_FILE=%LOG_DIR%\%HOSTNAME%-%TIMESTAMP%-DEBUG.txt" REM Create log directory if it doesn't exist if not exist "%LOG_DIR%" ( mkdir "%LOG_DIR%" 2>nul ) echo. echo ======================================== echo WinRM HTTPS Debug Test echo ======================================== echo. echo Computer: %HOSTNAME% echo Log File: %LOG_FILE% echo. REM Check for administrator privileges net session >nul 2>&1 if %errorLevel% neq 0 ( echo [ERROR] This script requires Administrator privileges. echo Please right-click and select "Run as Administrator" echo. pause exit /b 1 ) echo [OK] Running with Administrator privileges echo. REM Get the directory where this batch file is located set "SCRIPT_DIR=%~dp0" REM Check if PowerShell script exists if not exist "%SCRIPT_DIR%Test-RemotePC-Debug.ps1" ( echo [ERROR] Test-RemotePC-Debug.ps1 not found in script directory echo. pause exit /b 1 ) echo Running debug test... echo. REM Execute PowerShell script with bypass and log file PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command ^ "& '%SCRIPT_DIR%Test-RemotePC-Debug.ps1' -LogFile '%LOG_FILE%'" echo. echo ======================================== echo Test Complete echo ======================================== echo Log saved to: %LOG_FILE% echo. pause