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>
131 lines
5.0 KiB
Batchfile
131 lines
5.0 KiB
Batchfile
@echo off
|
|
REM ============================================================================
|
|
REM Deploy-WinRM-HTTPS-AutoPassword.bat
|
|
REM Deploys WinRM HTTPS configuration with HARDCODED PASSWORD
|
|
REM
|
|
REM WARNING: This file contains the certificate password in PLAINTEXT!
|
|
REM For TESTING ONLY - Do NOT use in production!
|
|
REM For production, use Deploy-WinRM-HTTPS.bat which prompts for password
|
|
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%.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 WinRM HTTPS Deployment Log (AUTO-PASSWORD VERSION) >> "%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 WARNING: Using hardcoded password for testing >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo. >> "%LOG_FILE%"
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo WinRM HTTPS Deployment (AUTO-PASSWORD)
|
|
echo ========================================
|
|
echo.
|
|
echo WARNING: Using hardcoded password!
|
|
echo This version is for TESTING ONLY!
|
|
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 Setup-WinRM-HTTPS.ps1 exists
|
|
if not exist "%SCRIPT_DIR%Setup-WinRM-HTTPS.ps1" (
|
|
echo [ERROR] Setup-WinRM-HTTPS.ps1 not found in script directory
|
|
echo [ERROR] Setup-WinRM-HTTPS.ps1 not found in script directory >> "%LOG_FILE%"
|
|
echo Please ensure all files are copied from the network share
|
|
echo Please ensure all files are copied from the network share >> "%LOG_FILE%"
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Check if certificate exists
|
|
if not exist "%SCRIPT_DIR%wildcard-*.pfx" (
|
|
echo [ERROR] Wildcard certificate PFX not found in script directory
|
|
echo [ERROR] Wildcard certificate PFX not found in script directory >> "%LOG_FILE%"
|
|
echo Please ensure the certificate file is present
|
|
echo Please ensure the certificate file is present >> "%LOG_FILE%"
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [OK] Required files found
|
|
echo [OK] Required files found >> "%LOG_FILE%"
|
|
echo.
|
|
|
|
REM ============================================================================
|
|
REM CERTIFICATE PASSWORD (HARDCODED FOR TESTING)
|
|
REM ============================================================================
|
|
REM TODO: Change this to your actual certificate password
|
|
set "CERT_PASSWORD=XqHuyaLZSyCYEcpsMz6h5"
|
|
REM ============================================================================
|
|
|
|
REM Execute PowerShell script with hardcoded password
|
|
echo Executing WinRM HTTPS setup with auto-password...
|
|
echo Executing WinRM HTTPS setup with auto-password... >> "%LOG_FILE%"
|
|
echo.
|
|
|
|
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
|
|
"$certPass = ConvertTo-SecureString '%CERT_PASSWORD%' -AsPlainText -Force; & '%SCRIPT_DIR%Setup-WinRM-HTTPS.ps1' -CertificatePath '%SCRIPT_DIR%wildcard-logon-ds-ge-com-20251017.pfx' -CertificatePassword $certPass -Domain 'logon.ds.ge.com' -LogFile '%LOG_FILE%'"
|
|
|
|
if %errorLevel% neq 0 (
|
|
echo.
|
|
echo [ERROR] Setup failed with error code: %errorLevel%
|
|
echo [ERROR] Setup 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] WinRM HTTPS Setup Complete
|
|
echo ========================================
|
|
echo.
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo [SUCCESS] WinRM HTTPS Setup Complete >> "%LOG_FILE%"
|
|
echo ============================================================================ >> "%LOG_FILE%"
|
|
echo Log saved to: %LOG_FILE%
|
|
echo.
|
|
pause
|