Initial commit: Organized PowerShell scripts for ShopDB asset collection
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>
This commit is contained in:
115
winrm-https/deployment-package/Deploy-WinRM-HTTPS.bat
Normal file
115
winrm-https/deployment-package/Deploy-WinRM-HTTPS.bat
Normal file
@@ -0,0 +1,115 @@
|
||||
@echo off
|
||||
REM ============================================================================
|
||||
REM Deploy-WinRM-HTTPS.bat
|
||||
REM Deploys WinRM HTTPS configuration to a shopfloor PC
|
||||
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 >> "%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 WinRM HTTPS Deployment
|
||||
echo ========================================
|
||||
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. | tee -a "%LOG_FILE%"
|
||||
echo Please right-click and select "Run as Administrator" | tee -a "%LOG_FILE%"
|
||||
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 Execute PowerShell script
|
||||
echo Executing WinRM HTTPS setup...
|
||||
echo Executing WinRM HTTPS setup... >> "%LOG_FILE%"
|
||||
echo.
|
||||
|
||||
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command ^
|
||||
"& '%SCRIPT_DIR%Setup-WinRM-HTTPS.ps1' -CertificatePath '%SCRIPT_DIR%wildcard-logon-ds-ge-com-20251017.pfx' -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
|
||||
Reference in New Issue
Block a user