Structure: - asset-collection/: Local PC data collection scripts - remote-execution/: WinRM remote execution scripts - setup-utilities/: Configuration and testing utilities - registry-backup/: GE registry backup scripts - winrm-https/: WinRM HTTPS certificate setup - docs/: Complete documentation Each folder includes a README with detailed documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
106 lines
3.6 KiB
Batchfile
106 lines
3.6 KiB
Batchfile
@echo off
|
|
REM ============================================================================
|
|
REM Deploy-PCCertificate.bat
|
|
REM Deploys PC-specific certificate from network share
|
|
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%-CERT-DEPLOY.txt"
|
|
|
|
REM Create log directory if it doesn't exist
|
|
if not exist "%LOG_DIR%" (
|
|
mkdir "%LOG_DIR%" 2>nul
|
|
)
|
|
|
|
REM Start logging
|
|
echo ============================================================================ > "%LOG_FILE%"
|
|
echo PC Certificate Deployment Log >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo Hostname: %HOSTNAME% >> "%LOG_FILE%"
|
|
echo Date/Time: %DATE% %TIME% >> "%LOG_FILE%"
|
|
echo Log File: %LOG_FILE% >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo. >> "%LOG_FILE%"
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo PC Certificate Deployment
|
|
echo ========================================
|
|
echo.
|
|
echo Hostname: %HOSTNAME%
|
|
echo.
|
|
echo Logging to: %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.
|
|
echo [ERROR] Administrator privileges required >> "%LOG_FILE%"
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [OK] Running with Administrator privileges
|
|
echo [OK] Running with Administrator privileges >> "%LOG_FILE%"
|
|
echo.
|
|
|
|
REM Get the directory where this batch file is located
|
|
set "SCRIPT_DIR=%~dp0"
|
|
echo Script directory: %SCRIPT_DIR%
|
|
echo Script directory: %SCRIPT_DIR% >> "%LOG_FILE%"
|
|
echo.
|
|
|
|
REM Check if PowerShell script exists
|
|
if not exist "%SCRIPT_DIR%Deploy-PCCertificate.ps1" (
|
|
echo [ERROR] Deploy-PCCertificate.ps1 not found in script directory
|
|
echo [ERROR] Deploy-PCCertificate.ps1 not found in script directory >> "%LOG_FILE%"
|
|
echo Please ensure all files are copied from the network share
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [OK] Required files found
|
|
echo [OK] Required files found >> "%LOG_FILE%"
|
|
echo.
|
|
|
|
REM Execute PowerShell script
|
|
echo Executing PC certificate deployment...
|
|
echo Executing PC certificate deployment... >> "%LOG_FILE%"
|
|
echo.
|
|
|
|
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
|
|
"& '%SCRIPT_DIR%Deploy-PCCertificate.ps1' -LogFile '%LOG_FILE%' -AllowedSubnets '10.48.130.0/23,10.134.48.0/24'"
|
|
|
|
if %errorLevel% neq 0 (
|
|
echo.
|
|
echo [ERROR] Deployment failed with error code: %errorLevel%
|
|
echo [ERROR] Deployment failed with error code: %errorLevel% >> "%LOG_FILE%"
|
|
echo. >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo Deployment FAILED >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo.
|
|
pause
|
|
exit /b %errorLevel%
|
|
)
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo [SUCCESS] Certificate Deployment Complete
|
|
echo ========================================
|
|
echo.
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo [SUCCESS] Certificate Deployment Complete >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo Log saved to: %LOG_FILE%
|
|
echo.
|
|
pause
|