# Sync Script Update Summary

**Date:** 2026-01-19
**File Modified:** \\192.168.0.6\C$\Shares\test\scripts\Sync-FromNAS.ps1
**Change:** Added DEPLOY.BAT to root-level sync

---

## Change Made

Added DEPLOY.BAT sync to match existing UPDATE.BAT sync pattern.

### Code Added (Lines 304-325)

```powershell
# Sync DEPLOY.BAT (root level utility)
Write-Log "Syncing DEPLOY.BAT..."
$deployBatLocal = "$AD2_TEST_PATH\DEPLOY.BAT"
if (Test-Path $deployBatLocal) {
    $deployBatRemote = "$NAS_DATA_PATH/DEPLOY.BAT"

    if ($DryRun) {
        Write-Log "  [DRY RUN] Would push: DEPLOY.BAT -> $deployBatRemote"
        $pushedFiles++
    } else {
        $success = Copy-ToNAS -LocalPath $deployBatLocal -RemotePath $deployBatRemote
        if ($success) {
            Write-Log "  Pushed: DEPLOY.BAT"
            $pushedFiles++
        } else {
            Write-Log "  ERROR: Failed to push DEPLOY.BAT"
            $errorCount++
        }
    }
} else {
    Write-Log "  WARNING: DEPLOY.BAT not found at $deployBatLocal"
}
```

---

## File Locations

### AD2 (Source)
- C:\Shares\test\UPDATE.BAT
- C:\Shares\test\DEPLOY.BAT

### NAS (Destination via Sync)
- /data/test/UPDATE.BAT (accessible as T:\UPDATE.BAT from DOS)
- /data/test/DEPLOY.BAT (accessible as T:\DEPLOY.BAT from DOS)

### COMMON/ProdSW (Also Synced)
- T:\COMMON\ProdSW\UPDATE.BAT (backup copy)
- T:\COMMON\ProdSW\DEPLOY.BAT (deployment script)
- T:\COMMON\ProdSW\NWTOC.BAT
- T:\COMMON\ProdSW\CTONW.BAT
- T:\COMMON\ProdSW\STAGE.BAT
- T:\COMMON\ProdSW\REBOOT.BAT
- T:\COMMON\ProdSW\CHECKUPD.BAT

---

## Purpose

### UPDATE.BAT at Root (T:\UPDATE.BAT)
- **Purpose:** Quick access backup utility from any DOS machine
- **Usage:** Can run `T:\UPDATE` from any machine without changing directory
- **Function:** Backs up C: drive to T:\%MACHINE%\BACKUP\

### DEPLOY.BAT at Root (T:\DEPLOY.BAT)
- **Purpose:** One-time deployment installer accessible from boot
- **Usage:** Run `T:\DEPLOY` to install update system on new/re-imaged machines
- **Function:** Installs all batch files, sets MACHINE variable, configures AUTOEXEC.BAT

**Benefit:** Both utilities are accessible from T: drive root, making them easy to find and run without navigating to COMMON\ProdSW\

---

## Sync Verification

**Sync Run:** 2026-01-19 12:55:14
**Result:** [OK] SUCCESS

```
2026-01-19 12:55:40 : Syncing UPDATE.BAT...
2026-01-19 12:55:41 :   Pushed: UPDATE.BAT
2026-01-19 12:55:41 : Syncing DEPLOY.BAT...
2026-01-19 12:55:43 :   Pushed: DEPLOY.BAT
```

Both files successfully pushed to NAS root directory.

---

## Sync Schedule

- **Frequency:** Every 15 minutes
- **Scheduled Task:** Windows Task Scheduler on AD2
- **Script:** C:\Shares\test\scripts\Sync-FromNAS.ps1
- **Log:** C:\Shares\test\scripts\sync-from-nas.log
- **Status:** C:\Shares\test\_SYNC_STATUS.txt

---

## Files Now Available on DOS Machines

### From Root (T:\)
```
T:\UPDATE.BAT    - Quick backup utility
T:\DEPLOY.BAT    - One-time deployment installer
```

### From COMMON (T:\COMMON\ProdSW\)
```
T:\COMMON\ProdSW\NWTOC.BAT      - Download updates
T:\COMMON\ProdSW\CTONW.BAT      - Upload changes (v1.2)
T:\COMMON\ProdSW\UPDATE.BAT     - Backup utility (copy)
T:\COMMON\ProdSW\STAGE.BAT      - Stage system files
T:\COMMON\ProdSW\REBOOT.BAT     - Apply staged updates
T:\COMMON\ProdSW\CHECKUPD.BAT   - Check for updates
T:\COMMON\ProdSW\DEPLOY.BAT     - Deployment installer (copy)
```

---

## Deployment Workflow

### New Machine Setup
1. Boot DOS machine with network access
2. Map T: drive: `NET USE T: \\D2TESTNAS\test /YES`
3. Run deployment: `T:\DEPLOY`
4. Follow prompts to enter machine name (e.g., TS-4R)
5. Reboot machine
6. Run initial download: `C:\BAT\NWTOC`

### Quick Backup from Root
```
T:\UPDATE
```
No need to CD to COMMON\ProdSW first.

---

## Testing Recommendations

### Test Root Access
From any DOS machine with T: drive mapped:
```batch
T:
DIR UPDATE.BAT
DIR DEPLOY.BAT
```

Both files should be visible at T: root.

### Test Deployment
On test machine (or VM):
```batch
T:\DEPLOY
```

Should run deployment installer successfully.

### Test Quick Backup
```batch
T:\UPDATE
```

Should back up C: drive to network.

---

## Maintenance Notes

### Updating Scripts
1. Edit files in D:\ClaudeTools\
2. Run: `powershell -File D:\ClaudeTools\copy-root-files-to-ad2.ps1`
3. Files copied to AD2 root: C:\Shares\test\
4. Next sync (within 15 min) pushes to NAS root
5. Files available at T:\ on DOS machines

### Monitoring Sync
```powershell
# Check sync log
Get-Content \\192.168.0.6\C$\Shares\test\scripts\sync-from-nas.log -Tail 50

# Check sync status
Get-Content \\192.168.0.6\C$\Shares\test\_SYNC_STATUS.txt
```

---

## Change History

| Date | Change | By |
|------|--------|-----|
| 2026-01-19 | Added DEPLOY.BAT to root-level sync | Claude Code |
| 2026-01-19 | UPDATE.BAT already syncing to root | (Existing) |

---

**Status:** [OK] COMPLETE AND TESTED
**Next Sync:** Automatic (every 15 minutes)
**Files Available:** T:\UPDATE.BAT and T:\DEPLOY.BAT
