@echo off REM ===================================================== REM Complete PC Asset Collection - SILENT MODE REM Runs Update-PC-CompleteAsset.ps1 with all output to log REM ===================================================== REM Change to script directory cd /d "%~dp0" REM Set network share log directory set "logdir=S:\dt\cameron\scan\logs" REM Create log directory if it doesn't exist (network share should already exist) if not exist "%logdir%" ( set "logdir=Logs" if not exist "Logs" mkdir "Logs" ) REM Generate log filename with timestamp for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set "datestamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" set "logfile=%logdir%\CompleteAsset-%COMPUTERNAME%-%datestamp%.log" REM Log start information echo ===================================== >> "%logfile%" 2>&1 echo Complete PC Asset Collection - %date% %time% >> "%logfile%" 2>&1 echo Computer: %COMPUTERNAME% >> "%logfile%" 2>&1 echo User Context: %USERNAME% >> "%logfile%" 2>&1 echo Script Directory: %CD% >> "%logfile%" 2>&1 echo Proxy: http://10.48.130.158/vendor-api-proxy.php >> "%logfile%" 2>&1 echo Dashboard: https://tsgwp00525.rd.ds.ge.com/shopdb/api.asp >> "%logfile%" 2>&1 echo Network Load Balancing: Disabled >> "%logfile%" 2>&1 echo ===================================== >> "%logfile%" 2>&1 echo. >> "%logfile%" 2>&1 REM Check if PowerShell script exists if not exist "Update-PC-CompleteAsset.ps1" ( echo ERROR: Update-PC-CompleteAsset.ps1 not found! >> "%logfile%" 2>&1 exit /b 1 ) if not exist "Get-ShopfloorConfig.ps1" ( echo WARNING: Get-ShopfloorConfig.ps1 not found - shopfloor config may fail >> "%logfile%" 2>&1 ) REM Load balancing disabled - no random delay REM powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -WindowStyle Hidden -Command "Start-Sleep -Seconds (Get-Random -Minimum 0 -Maximum 600)" >> "%logfile%" 2>&1 REM Backup GE Aircraft Engines registry if it exists (silent mode) echo Checking for GE Aircraft Engines registry... >> "%logfile%" 2>&1 if exist "Backup-GERegistry.ps1" ( powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -WindowStyle Hidden -File "%~dp0Backup-GERegistry.ps1" -Silent >> "%logfile%" 2>&1 if %ERRORLEVEL% equ 0 ( echo GE registry backup completed successfully >> "%logfile%" 2>&1 ) else ( echo GE registry not found or backup skipped >> "%logfile%" 2>&1 ) ) else ( echo Backup-GERegistry.ps1 not found - skipping registry backup >> "%logfile%" 2>&1 ) echo. >> "%logfile%" 2>&1 REM Run PowerShell script directly echo. >> "%logfile%" 2>&1 echo === Running PowerShell script === >> "%logfile%" 2>&1 echo. >> "%logfile%" 2>&1 powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -WindowStyle Hidden -File "%~dp0Update-PC-CompleteAsset.ps1" -ProxyURL "http://10.48.130.158/vendor-api-proxy.php" -DashboardURL "https://tsgwp00525.rd.ds.ge.com/shopdb/api.asp" >> "%logfile%" 2>&1 echo. >> "%logfile%" 2>&1 echo === Script completed === >> "%logfile%" 2>&1 echo Exit code: %ERRORLEVEL% >> "%logfile%" 2>&1 echo End time: %date% %time% >> "%logfile%" 2>&1 echo. >> "%logfile%" 2>&1