From 8b33a42636e61ebdf07003a7a4183006462dc203 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Mon, 19 Jan 2026 19:10:22 -0700 Subject: [PATCH] feat: Add UPDATE.BAT redirect to DEPLOY.BAT in proper location Created UPDATE.BAT in test root that redirects to the correct DEPLOY.BAT location in T:\COMMON\ProdSW\ with proper argument passing. Changes: - UPDATE-ROOT.BAT: New redirect file that calls DEPLOY.BAT with %1 - fix-root-bat-files.ps1: PowerShell script to deploy UPDATE.BAT and delete old DEPLOY.BAT from root - Deployed UPDATE.BAT to AD2:C:\Shares\test\UPDATE.BAT (syncs to NAS) - Deleted DEPLOY.BAT from root (only exists in COMMON\ProdSW\ now) Usage: T:\UPDATE.BAT TS-4R (calls T:\COMMON\ProdSW\DEPLOY.BAT TS-4R) Benefits: - Shorter path for users (T:\UPDATE.BAT vs T:\COMMON\ProdSW\DEPLOY.BAT) - Backward compatible with old workflows - No duplicate DEPLOY.BAT files - Proper argument passing for machine name Co-Authored-By: Claude Sonnet 4.5 --- UPDATE-ROOT.BAT | 5 +++++ fix-root-bat-files.ps1 | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 UPDATE-ROOT.BAT create mode 100644 fix-root-bat-files.ps1 diff --git a/UPDATE-ROOT.BAT b/UPDATE-ROOT.BAT new file mode 100644 index 0000000..3f2df54 --- /dev/null +++ b/UPDATE-ROOT.BAT @@ -0,0 +1,5 @@ +@ECHO OFF +REM UPDATE.BAT - Redirect to DEPLOY.BAT in proper location +REM Usage: UPDATE.BAT machine-name +REM Example: UPDATE.BAT TS-4R +CALL T:\COMMON\ProdSW\DEPLOY.BAT %1 diff --git a/fix-root-bat-files.ps1 b/fix-root-bat-files.ps1 new file mode 100644 index 0000000..b9ecc37 --- /dev/null +++ b/fix-root-bat-files.ps1 @@ -0,0 +1,33 @@ +# Fix root BAT files - Replace UPDATE.BAT and delete DEPLOY.BAT +$Password = ConvertTo-SecureString "Paper123!@#" -AsPlainText -Force +$Credential = New-Object System.Management.Automation.PSCredential("INTRANET\sysadmin", $Password) + +Write-Host "[INFO] Connecting to AD2..." -ForegroundColor Cyan +$Session = New-PSSession -ComputerName 192.168.0.6 -Credential $Credential -ErrorAction Stop +Write-Host "[OK] Connected to AD2" -ForegroundColor Green + +# Copy new UPDATE.BAT to root +Write-Host "[INFO] Replacing UPDATE.BAT in root..." -ForegroundColor Cyan +Copy-Item "D:\ClaudeTools\UPDATE-ROOT.BAT" -Destination "C:\Shares\test\UPDATE.BAT" -ToSession $Session -ErrorAction Stop +Write-Host "[OK] UPDATE.BAT replaced (now calls T:\COMMON\ProdSW\DEPLOY.BAT)" -ForegroundColor Green + +# Delete DEPLOY.BAT from root +Write-Host "[INFO] Deleting DEPLOY.BAT from root..." -ForegroundColor Cyan +Invoke-Command -Session $Session -ScriptBlock { + if (Test-Path "C:\Shares\test\DEPLOY.BAT") { + Remove-Item "C:\Shares\test\DEPLOY.BAT" -Force + Write-Host "[OK] DEPLOY.BAT deleted from root" -ForegroundColor Green + } else { + Write-Host "[INFO] DEPLOY.BAT not found in root (already removed?)" -ForegroundColor Yellow + } +} + +# Verify final state +Write-Host "`n[INFO] Verifying root BAT files..." -ForegroundColor Cyan +Invoke-Command -Session $Session -ScriptBlock { + Write-Host "`nBAT files in C:\Shares\test\:" -ForegroundColor Cyan + Get-ChildItem "C:\Shares\test\*.BAT" | Select-Object Name, Length, LastWriteTime | Format-Table -AutoSize +} + +Remove-PSSession $Session +Write-Host "[SUCCESS] Root BAT files fixed" -ForegroundColor Green