     1→# Dataforth DOS Project - Network Topology
     2→
     3→## Network Diagram
     4→
     5→```
     6→Internet
     7→    |
     8→    | (VPN)
     9→    |
    10→[Dataforth UDM - 192.168.0.254]
    11→    |
    12→    +--- 192.168.0.0/24 Network ---+
    13→    |                              |
    14→    |                              |
    15→[AD2 - 192.168.0.6]        [D2TESTNAS - 192.168.0.9]
    16→(Production Server)         (SMB1 Proxy / NAS)
    17→INTRANET Domain                   |
    18→Windows Server                    |
    19→  - SMB3 only                     +--- SMB1 CORE Protocol
    20→  - \\AD2\test                    |    WINS Server
    21→  - \\AD2\datasheets (pending)    |    NetBIOS: D2TESTNAS
    22→                                  |
    23→                                  |
    24→                    +-------------+-------------+
    25→                    |             |             |
    26→                [TS-1]        [TS-2]   ...  [TS-30]
    27→             DOS 6.22       DOS 6.22       DOS 6.22
    28→          192.168.0.x    192.168.0.x    192.168.0.x
    29→               (DHCP)         (DHCP)         (DHCP)
    30→
    31→          T: = \\D2TESTNAS\test
    32→          X: = \\D2TESTNAS\datasheets
    33→```
    34→
    35→## Data Flow
    36→
    37→### Test Results Upload (DOS → AD2)
    38→```
    39→DOS Machine
    40→    ↓ (writes to T:\TS-XX\LOGS\, T:\TS-XX\Reports\)
    41→NAS D2TESTNAS (192.168.0.9)
    42→    ↓ (sync every 15 min via /root/sync-to-ad2.sh)
    43→AD2 Production Server (192.168.0.6)
    44→    ↓ (\\AD2\test\TS-XX\LOGS\, \\AD2\test\TS-XX\Reports\)
    45→Engineering Access / Automated Processing
    46→```
    47→
    48→### Software Updates (AD2 → DOS)
    49→```
    50→Engineering
    51→    ↓ (places files in \\AD2\test\TS-XX\ProdSW\ or \\AD2\test\COMMON\ProdSW\)
    52→AD2 Production Server (192.168.0.6)
    53→    ↓ (sync every 15 min via /root/sync-to-ad2.sh)
    54→NAS D2TESTNAS (192.168.0.9)
    55→    ↓ (DOS runs NWTOC.BAT on boot or T:\UPDATE TS-XX SCRIPTS)
    56→DOS Machine (C:\ATE\, C:\BAT\)
    57→```
    58→
    59→## Network Details
    60→
    61→### IP Allocation
    62→| Device | IP | MAC | Notes |
    63→|--------|-----|-----|-------|
    64→| UDM Gateway | 192.168.0.254 | - | Firewall, DHCP server |
    65→| AD2 Server | 192.168.0.6 | - | Static, Domain Controller |
    66→| D2TESTNAS | 192.168.0.9 | 28:C6:8E:34:4B:5E/5F | Static |
    67→| DOS Machines | 192.168.0.x | Various | DHCP |
    68→
    69→### DHCP Configuration (via UniFi UDM)
    70→- **Network:** 192.168.0.0/24
    71→- **Gateway:** 192.168.0.254
    72→- **DNS:** (Domain controllers)
    73→- **WINS Server:** 192.168.0.9 (D2TESTNAS)
    74→- **Lease Time:** Standard
    75→
    76→### DNS/NetBIOS Resolution
    77→- **WINS Server:** 192.168.0.9 (D2TESTNAS)
    78→- **NetBIOS Names:**
    79→  - D2TESTNAS → 192.168.0.9
    80→  - AD2 → 192.168.0.6
    81→- DOS machines use WINS for name resolution (no DNS)
    82→
    83→### SMB Protocol Versions
    84→| System | Protocol | Reason |
    85→|--------|----------|--------|
    86→| DOS Machines | SMB1 CORE | Only version supported by MS Network Client 3.11 |
    87→| NAS D2TESTNAS | SMB1 CORE | Compatibility with DOS |
    88→| AD2 Server | SMB3 only | Security - SMB1 disabled after crypto attack |
    89→
    90→## Firewall Rules
    91→
    92→No special firewall rules needed:
    93→- All devices on same 192.168.0.0/24 subnet
    94→- Local LAN traffic allowed
    95→- NAS initiates outbound SMB to AD2 (port 445)
    96→
    97→## Remote Access
    98→
    99→### VPN Access (if needed)
   100→- **VPN Server:** Dataforth UDM (192.168.0.254)
   101→- **Protocol:** OpenVPN
   102→- **Authentication:** RADIUS (Active Directory)
   103→- **Config File:** C:/Users/MikeSwanson/Desktop/dataforth-vpn.ovpn
   104→- **Network after VPN:** 192.168.0.0/24
   105→
   106→See session-logs/2025-12-20-session.md for VPN setup details.
   107→
   108→## Network Services
   109→
   110→### WINS (Windows Internet Name Service)
   111→- **Server:** D2TESTNAS (192.168.0.9)
   112→- **Purpose:** NetBIOS name resolution for DOS machines
   113→- **Configuration:** Enabled in smb.conf (`wins support = yes`)
   114→
   115→### SMB/CIFS
   116→- **NAS Shares:**
   117→  - \\D2TESTNAS\test (port 445/139)
   118→  - \\D2TESTNAS\datasheets (port 445/139)
   119→- **AD2 Shares:**
   120→  - \\AD2\test (port 445)
   121→  - \\AD2\datasheets (pending creation)
   122→
   123→### SSH
   124→- **NAS:** Port 22 (root@192.168.0.9)
   125→- **Authentication:** ed25519 key
   126→
   127→## Network Testing
   128→
   129→### From DOS Machine
   130→```batch
   131→ping 192.168.0.9
   132→net use T: \\D2TESTNAS\test
   133→net use
   134→```
   135→
   136→### From Linux/WSL
   137→```bash
   138→# Ping NAS
   139→ping 192.168.0.9
   140→
   141→# Test SMB to NAS
   142→smbclient //192.168.0.9/test -U ts-1 -N -c 'ls'
   143→
   144→# Test SMB to AD2
   145→smbclient //192.168.0.6/test -U sysadmin%'Paper123!@#' -c 'ls'
   146→
   147→# SSH to NAS
   148→ssh root@192.168.0.9
   149→```
   150→
   151→## Notes
   152→
   153→- DOS machines cannot use SMB2+ (requires Windows 95 OSR2 or later)
   154→- NAS acts as protocol translator/proxy (SMB1 CORE ↔ SMB3)
   155→- WINS is critical - DOS machines need NetBIOS name resolution
   156→- All DOS machines use DHCP, get WINS server automatically
   157→- No DNS on DOS machines - only NetBIOS/WINS
   158→

<system-reminder>
Whenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.
</system-reminder>

# Dataforth DOS Project - Network Topology

## Network Diagram

```
Internet
    |
    | (VPN)
    |
[Dataforth UDM - 192.168.0.254]
    |
    +--- 192.168.0.0/24 Network ---+
    |                              |
    |                              |
[AD2 - 192.168.0.6]        [D2TESTNAS - 192.168.0.9]
(Production Server)         (SMB1 Proxy / NAS)
INTRANET Domain                   |
Windows Server                    |
  - SMB3 only                     +--- SMB1 CORE Protocol
  - \\AD2\test                    |    WINS Server
  - \\AD2\datasheets (pending)    |    NetBIOS: D2TESTNAS
                                  |
                                  |
                    +-------------+-------------+
                    |             |             |
                [TS-1]        [TS-2]   ...  [TS-30]
             DOS 6.22       DOS 6.22       DOS 6.22
          192.168.0.x    192.168.0.x    192.168.0.x
               (DHCP)         (DHCP)         (DHCP)

          T: = \\D2TESTNAS\test
          X: = \\D2TESTNAS\datasheets
```

## Data Flow

### Test Results Upload (DOS → AD2)
```
DOS Machine
    ↓ (writes to T:\TS-XX\LOGS\, T:\TS-XX\Reports\)
NAS D2TESTNAS (192.168.0.9)
    ↓ (sync every 15 min via /root/sync-to-ad2.sh)
AD2 Production Server (192.168.0.6)
    ↓ (\\AD2\test\TS-XX\LOGS\, \\AD2\test\TS-XX\Reports\)
Engineering Access / Automated Processing
```

### Software Updates (AD2 → DOS)
```
Engineering
    ↓ (places files in \\AD2\test\TS-XX\ProdSW\ or \\AD2\test\COMMON\ProdSW\)
AD2 Production Server (192.168.0.6)
    ↓ (sync every 15 min via /root/sync-to-ad2.sh)
NAS D2TESTNAS (192.168.0.9)
    ↓ (DOS runs NWTOC.BAT on boot or T:\UPDATE TS-XX SCRIPTS)
DOS Machine (C:\ATE\, C:\BAT\)
```

## Network Details

### IP Allocation
| Device | IP | MAC | Notes |
|--------|-----|-----|-------|
| UDM Gateway | 192.168.0.254 | - | Firewall, DHCP server |
| AD2 Server | 192.168.0.6 | - | Static, Domain Controller |
| D2TESTNAS | 192.168.0.9 | 28:C6:8E:34:4B:5E/5F | Static |
| DOS Machines | 192.168.0.x | Various | DHCP |

### DHCP Configuration (via UniFi UDM)
- **Network:** 192.168.0.0/24
- **Gateway:** 192.168.0.254
- **DNS:** (Domain controllers)
- **WINS Server:** 192.168.0.9 (D2TESTNAS)
- **Lease Time:** Standard

### DNS/NetBIOS Resolution
- **WINS Server:** 192.168.0.9 (D2TESTNAS)
- **NetBIOS Names:**
  - D2TESTNAS → 192.168.0.9
  - AD2 → 192.168.0.6
- DOS machines use WINS for name resolution (no DNS)

### SMB Protocol Versions
| System | Protocol | Reason |
|--------|----------|--------|
| DOS Machines | SMB1 CORE | Only version supported by MS Network Client 3.11 |
| NAS D2TESTNAS | SMB1 CORE | Compatibility with DOS |
| AD2 Server | SMB3 only | Security - SMB1 disabled after crypto attack |

## Firewall Rules

No special firewall rules needed:
- All devices on same 192.168.0.0/24 subnet
- Local LAN traffic allowed
- NAS initiates outbound SMB to AD2 (port 445)

## Remote Access

### VPN Access (if needed)
- **VPN Server:** Dataforth UDM (192.168.0.254)
- **Protocol:** OpenVPN
- **Authentication:** RADIUS (Active Directory)
- **Config File:** C:/Users/MikeSwanson/Desktop/dataforth-vpn.ovpn
- **Network after VPN:** 192.168.0.0/24

See session-logs/2025-12-20-session.md for VPN setup details.

## Network Services

### WINS (Windows Internet Name Service)
- **Server:** D2TESTNAS (192.168.0.9)
- **Purpose:** NetBIOS name resolution for DOS machines
- **Configuration:** Enabled in smb.conf (`wins support = yes`)

### SMB/CIFS
- **NAS Shares:**
  - \\D2TESTNAS\test (port 445/139)
  - \\D2TESTNAS\datasheets (port 445/139)
- **AD2 Shares:**
  - \\AD2\test (port 445)
  - \\AD2\datasheets (pending creation)

### SSH
- **NAS:** Port 22 (root@192.168.0.9)
- **Authentication:** ed25519 key

## Network Testing

### From DOS Machine
```batch
ping 192.168.0.9
net use T: \\D2TESTNAS\test
net use
```

### From Linux/WSL
```bash
# Ping NAS
ping 192.168.0.9

# Test SMB to NAS
smbclient //192.168.0.9/test -U ts-1 -N -c 'ls'

# Test SMB to AD2
smbclient //192.168.0.6/test -U sysadmin%'Paper123!@#' -c 'ls'

# SSH to NAS
ssh root@192.168.0.9
```

## Notes

- DOS machines cannot use SMB2+ (requires Windows 95 OSR2 or later)
- NAS acts as protocol translator/proxy (SMB1 CORE ↔ SMB3)
- WINS is critical - DOS machines need NetBIOS name resolution
- All DOS machines use DHCP, get WINS server automatically
- No DNS on DOS machines - only NetBIOS/WINS


total 212
drwxr-xr-x 1 AzureAD+MikeSwanson 4096     0 Jan 15 12:02 ./
drwxr-xr-x 1 AzureAD+MikeSwanson 4096     0 Jan 13 19:04 ../
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  2527 Jan 13 21:51 CREDENTIALS.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096 11551 Jan 13 17:50 DOS_BATCH_FILES.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  5525 Jan 13 17:49 GITEA_ACCESS.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  4429 Jan 13 17:46 NETWORK_TOPOLOGY.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  4447 Jan 13 17:51 PROJECT_INDEX.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096 11575 Jan 13 21:51 README.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  5752 Jan 13 21:51 REMAINING_TASKS.md
drwxr-xr-x 1 AzureAD+MikeSwanson 4096     0 Jan 13 21:51 session-logs/
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  7159 Jan 13 21:51 SYNC_SCRIPT.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  5310 Jan 15 12:02 UPDATE-BAT-SYNC-COMPLETED.md
-rw-r--r-- 1 AzureAD+MikeSwanson 4096  3868 Jan 15 11:46 UPDATE-BAT-SYNC-FIX.md


Perfect! I now have a comprehensive understanding of the current UPDATE.BAT system. Let me design the simplified version based on the requirements.

## Analysis of Current UPDATE.BAT

Based on the documentation, I've analyzed the current implementation:

**Current Commands (5):**
1. **CHECK** - Shows DOS version, lists directories
2. **BACKUP** - Backs up ATE, BAT folders, CONFIG.SYS, AUTOEXEC.BAT to network
3. **SCRIPTS** - Syncs batch files from BOTH:
   - `T:\COMMON\ProdSW\*.BAT` (all stations)
   - `T:\TS-XX\ProdSW\*.BAT` (station-specific) ← **TO BE REMOVED**
4. **DOS** - Complex staged update for DOS system files (requires reboot)
5. **ALL** - Runs CHECK → BACKUP → SCRIPTS (but not DOS)

**Current Station Parameter:**
- Required as first parameter
- Used for backup paths and station-specific sync
- Example: `UPDATE TS-27 BACKUP`

---

## Simplified UPDATE.BAT Design

### 1. New Command Structure

**Reduce from 5 commands to 3:**

| Command | Purpose | What It Does |
|---------|---------|--------------|
| **STATUS** | Quick health check | Shows DOS version, disk space, verifies T: drive access |
| **UPDATE** | Main operation | Auto-checks → Backs up → Updates scripts (COMMON only) |
| **DOS** | System update | Updates DOS system files (kept separate due to reboot requirement) |

**Rationale:**
- **STATUS** replaces CHECK with better name and adds disk space check
- **UPDATE** combines CHECK + BACKUP + SCRIPTS into single operation (most common use case)
- **DOS** remains separate due to complexity and risk (requires manual intervention + reboot)
- Removed **ALL** command (redundant - UPDATE is the new "all")

### 2. Parameter Requirements

**Station name becomes OPTIONAL with auto-detection:**

```batch
REM New usage patterns:
T:\UPDATE                    (auto-detect station from SYSTEM.INI)
T:\UPDATE STATUS             (auto-detect station)
T:\UPDATE UPDATE             (auto-detect station)
T:\UPDATE TS-27 UPDATE       (explicit station override)

REM Backward compatible:
T:\UPDATE TS-27 STATUS       (still works)
```

**Station Detection Logic:**
1. Check if first parameter looks like command (STATUS/UPDATE/DOS)
2. If yes, try to auto-detect station from `C:\NET\SYSTEM.INI` (computername=TS-XX)
3. If no, treat first parameter as station name (backward compatible)
4. If auto-detect fails and no station provided, show error

### 3. Implementation Approach for Each Command

#### STATUS Command (formerly CHECK)
**Purpose:** Quick diagnostic without making changes

```batch
:STATUS
ECHO.
ECHO ====================================
ECHO Status Check for %STATION%
ECHO ====================================
ECHO.

REM DOS Version
ECHO DOS Version:
VER

REM Disk Space
ECHO.
ECHO Disk Space:
DIR C:\

REM Network Access
ECHO.
ECHO Network Access:
IF EXIST T:\COMMON ECHO   T: drive accessible - OK
IF NOT EXIST T:\COMMON ECHO   T: drive ERROR - Cannot access network

REM Key directories
ECHO.
ECHO Installed Software:
IF EXIST C:\ATE ECHO   C:\ATE - OK
IF EXIST C:\BAT ECHO   C:\BAT - OK
IF EXIST C:\DOS ECHO   C:\DOS - OK

GOTO END
```

**Changes from CHECK:**
- Better formatting with section headers
- Added network connectivity check
- Added disk space visibility
- Removed detailed DIR listings (too verbose)

#### UPDATE Command (formerly ALL)
**Purpose:** One-stop update operation

```batch
:UPDATE
ECHO.
ECHO ====================================
ECHO Updating %STATION%
ECHO ====================================
ECHO.

REM Step 1: Quick status check
ECHO [1/3] Checking system status...
VER
IF NOT EXIST T:\COMMON GOTO ERROR_NETWORK

REM Step 2: Backup
ECHO.
ECHO [2/3] Backing up to T:\%STATION%\Backup\...
IF NOT EXIST T:\%STATION%\Backup MKDIR T:\%STATION%\Backup
IF NOT EXIST T:\%STATION%\Backup\ATE MKDIR T:\%STATION%\Backup\ATE
IF NOT EXIST T:\%STATION%\Backup\BAT MKDIR T:\%STATION%\Backup\BAT

XCOPY C:\ATE\*.* T:\%STATION%\Backup\ATE\ /S /E /Y > NUL
XCOPY C:\BAT\*.* T:\%STATION%\Backup\BAT\ /S /E /Y > NUL
COPY C:\CONFIG.SYS T:\%STATION%\Backup\ > NUL
COPY C:\AUTOEXEC.BAT T:\%STATION%\Backup\ > NUL
ECHO   Backup complete

REM Step 3: Update scripts (COMMON only - station-specific removed)
ECHO.
ECHO [3/3] Updating batch files...
IF EXIST T:\COMMON\ProdSW\*.BAT COPY T:\COMMON\ProdSW\*.BAT C:\BAT\ /Y
ECHO   Scripts updated from COMMON

ECHO.
ECHO ====================================
ECHO Update Complete!
ECHO ====================================
ECHO.
ECHO If you see DOS version errors, run:
ECHO   T:\UPDATE %STATION% DOS
ECHO.
GOTO END

:ERROR_NETWORK
ECHO ERROR: Cannot access T:\COMMON
ECHO Check network connection
GOTO END
```

**Changes:**
- Combines CHECK + BACKUP + SCRIPTS
- Shows progress (1/3, 2/3, 3/3)
- **Removes station-specific ProdSW sync** (per requirements)
- Only syncs `T:\COMMON\ProdSW\*.BAT`
- Cleaner output (redirects XCOPY noise to NUL)
- Better error handling

#### DOS Command (unchanged logic, cleaner presentation)
**Purpose:** System-level DOS update (high risk, requires reboot)

```batch
:DOS
ECHO.
ECHO ====================================
ECHO DOS System Update for %STATION%
ECHO ====================================
ECHO.
ECHO WARNING: This will update DOS system files
ECHO          Machine must reboot to complete
ECHO.
ECHO Files to update:
ECHO   - COMMAND.COM (staged for next boot)
ECHO   - DOS utilities (*.EXE, *.COM, *.SYS)
ECHO.
ECHO Press Ctrl+C to cancel, or
PAUSE

REM Stage COMMAND.COM (can't overwrite while running)
COPY T:\COMMON\DOS\COMMAND.COM C:\COMMAND.NEW > NUL
COPY C:\AUTOEXEC.BAT C:\AUTOEXEC.SAV > NUL

REM Create boot-time update script
ECHO @ECHO OFF > C:\AUTOEXEC.BAT
ECHO ECHO Applying DOS update... >> C:\AUTOEXEC.BAT
ECHO COPY C:\COMMAND.NEW C:\DOS\COMMAND.COM >> C:\AUTOEXEC.BAT
ECHO DEL C:\COMMAND.NEW >> C:\AUTOEXEC.BAT
ECHO COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT >> C:\AUTOEXEC.BAT
ECHO DEL C:\AUTOEXEC.SAV >> C:\AUTOEXEC.BAT
ECHO CALL C:\AUTOEXEC.BAT >> C:\AUTOEXEC.BAT

REM Update other DOS files immediately
COPY T:\COMMON\DOS\*.EXE C:\DOS\ /Y > NUL
COPY T:\COMMON\DOS\*.COM C:\DOS\ /Y > NUL
COPY T:\COMMON\DOS\*.SYS C:\DOS\ /Y > NUL

ECHO.
ECHO DOS files staged for update
ECHO.
ECHO REBOOT NOW to complete the update
ECHO.
GOTO END
```

**Changes:**
- Better formatted warnings
- Shows what will be updated
- Cleaner output (redirects to NUL)
- Same staging logic (proven to work)

### 4. Migration Path for Existing Deployments

**Phase 1: Deploy New Version (Backward Compatible)**
1. New UPDATE.BAT supports both old and new syntax:
   - `UPDATE TS-27 SCRIPTS` → Still works (mapped to UPDATE command)
   - `UPDATE TS-27 CHECK` → Still works (mapped to STATUS command)
   - `UPDATE TS-27 BACKUP` → Still works (now part of UPDATE command)
   - `UPDATE TS-27 ALL` → Still works (mapped to UPDATE command)
2. Add deprecation warnings for old commands
3. Deploy via existing sync system (placed in `T:\UPDATE.BAT`)

**Phase 2: Update Documentation**
1. Update engineer documentation
2. Send email to Engineering team explaining changes
3. Provide command translation table

**Phase 3: Remove Station-Specific Sync (Already Done)**
- Station-specific `T:\TS-XX\ProdSW\*.BAT` folders can be archived or removed
- All batch files now live in `T:\COMMON\ProdSW\`
- No code changes needed (UPDATE no longer looks there)

**Rollback Plan:**
- Keep old UPDATE.BAT as `UPDATE.OLD` on network
- Can be restored by copying back to UPDATE.BAT

### 5. Impact on Related Files

#### NWTOC.BAT (Auto-Boot Update)
**Current state:**
```batch
IF EXIST T:\COMMON\ProdSW\*.BAT COPY T:\COMMON\ProdSW\*.BAT C:\BAT\
IF EXIST T:\%STATION%\ProdSW\*.BAT COPY T:\%STATION%\ProdSW\*.BAT C:\BAT\
```

**Should be updated to:**
```batch
REM Update common batch files only
IF EXIST T:\COMMON\ProdSW\*.BAT COPY T:\COMMON\ProdSW\*.BAT C:\BAT\ /Y
REM Station-specific sync removed per 2026-01-15 UPDATE.BAT simplification
```

**Deployment:** NWTOC.BAT is per-station, update via TODO.BAT:
```batch
@ECHO OFF
REM TODO.BAT - Update NWTOC.BAT to remove station-specific sync
ECHO Updating NWTOC.BAT for %1...
COPY T:\COMMON\NWTOC-NEW.BAT C:\BAT\NWTOC.BAT /Y
COPY T:\COMMON\NWTOC-NEW.BAT T:\%1\NWTOC.BAT /Y
ECHO Done - NWTOC.BAT updated
```

#### AD2 Sync Script (No Change Required)
The PowerShell sync script (`Sync-FromNAS.ps1`) already syncs:
- `T:\COMMON\ProdSW\*` (still needed)
- `T:\TS-XX\ProdSW\*` (can remain but unused)
- `T:\UPDATE.BAT` (already added per recent fix)

**Recommendation:** Leave sync as-is for now. Station-specific folders become unused but harmless.

#### Engineer Documentation
**Update these sections:**
```markdown
### Deploying Software Updates

**For all machines:**
1. Place .BAT files in `\\AD2\test\COMMON\ProdSW\`
2. Wait 15 minutes for sync (or run manual sync)
3. Updates deploy on next boot or via `T:\UPDATE UPDATE`

**Note:** Station-specific ProdSW folders are no longer used as of January 2026.
```

---

## Additional Design Considerations

### Optional Enhancements (Not Required, But Useful)

1. **Add /NOBACKUP Flag:**
   ```batch
   T:\UPDATE UPDATE /NOBACKUP   (skip backup, faster)
   ```

2. **Add Quiet Mode:**
   ```batch
   T:\UPDATE UPDATE /QUIET      (minimal output)
   ```

3. **Log File Creation:**
   - Write summary to `C:\UPDATE.LOG`
   - Timestamp, command, result

4. **Network Speed Test:**
   - Time the backup operation
   - Warn if unusually slow

### Why Station Name Could Become Optional

**Current Uses of Station Name:**
1. ~~Station-specific ProdSW sync~~ → REMOVED
2. Backup path (`T:\%STATION%\Backup\`) → Still needed
3. ~~TODO.BAT execution~~ → Not in UPDATE.BAT
4. Display purposes (messages)

**Auto-Detection Source:**
`C:\NET\SYSTEM.INI` contains `computername=TS-XX`

**Parsing Logic:**
```batch
REM Extract station name from SYSTEM.INI
FOR /F "tokens=2 delims==" %%A IN ('TYPE C:\NET\SYSTEM.INI ^| FIND "computername="') DO SET STATION=%%A
IF "%STATION%"=="" GOTO ERROR_NO_STATION
```

**Benefits:**
- Simpler for engineers: `T:\UPDATE UPDATE` instead of `T:\UPDATE TS-27 UPDATE`
- Fewer typing errors
- Can still override if needed

**Risks:**
- SYSTEM.INI might not exist on all machines
- Computername might not match expected format
- Need good error handling

**Recommendation:** Implement auto-detection but keep backward compatibility.

---

## Summary: Before vs After

### Current UPDATE.BAT (Complex)
```batch
T:\UPDATE TS-27 CHECK      (view status)
T:\UPDATE TS-27 BACKUP     (backup only)
T:\UPDATE TS-27 SCRIPTS    (update common + station-specific)
T:\UPDATE TS-27 DOS        (update DOS system)
T:\UPDATE TS-27 ALL        (check + backup + scripts)
```

**Issues:**
- Too many commands for simple workflow
- Station-specific sync adds complexity
- ALL doesn't include DOS (confusing)
- CHECK name is generic

### Simplified UPDATE.BAT (Clean)
```batch
T:\UPDATE STATUS           (quick diagnostic)
T:\UPDATE UPDATE           (check + backup + scripts in one)
T:\UPDATE DOS              (system update, kept separate)

REM Optional explicit station:
T:\UPDATE TS-27 STATUS
T:\UPDATE TS-27 UPDATE
T:\UPDATE TS-27 DOS

REM Backward compatible:
T:\UPDATE TS-27 CHECK      (maps to STATUS)
T:\UPDATE TS-27 ALL        (maps to UPDATE)
```

**Improvements:**
- 60% fewer commands (5→3)
- No station-specific complexity
- Clear primary workflow (UPDATE command)
- Auto-detection reduces typing
- Better command names (STATUS vs CHECK)
- Progress indicators
- Cleaner output

---

### Critical Files for Implementation

Based on this design, here are the files most critical for implementing the simplified UPDATE.BAT:

- **T:\UPDATE.BAT** (on NAS: `/data/test/UPDATE.BAT`) - Primary implementation file, contains all command logic, must have DOS line endings (CR+LF)

- **T:\COMMON\ProdSW\CTONW.BAT** (on NAS: `/data/test/COMMON/ProdSW/CTONW.BAT`) - Reference for existing batch file patterns, DOS 6.22 compatibility examples, needs to follow same standards

- **T:\TS-XX\NWTOC.BAT** (example: `/data/test/TS-27/NWTOC.BAT`) - Boot-time update script that needs modification to remove station-specific sync, currently syncs from both COMMON and TS-XX folders

- **C:\Shares\test\scripts\Sync-FromNAS.ps1** (on AD2: 192.168.0.6) - Already updated to sync UPDATE.BAT, reference for deployment workflow, shows how files propagate from AD2→NAS→DOS

- **C:\NET\SYSTEM.INI** (on DOS machines) - Contains `computername=TS-XX` for auto-detection feature, pattern to follow for parsing station name