# DOS Update System - Deployment Guide

**Last Updated:** 2026-01-19
**Target Systems:** ~30 DOS 6.22 test stations (TS-4R, TS-7A, TS-12B, etc.)
**Deployment Script:** DEPLOY.BAT
**Status:** Ready for Production Deployment

---

## Overview

This guide walks through deploying the new DOS Update System to test station machines. The deployment is a **one-time process** per machine that installs batch files and configures the machine for automatic updates.

**What Gets Installed:**
- NWTOC.BAT - Download updates from network
- CTONW.BAT - Upload changes to network
- UPDATE.BAT - Full system backup
- STAGE.BAT - System file staging
- REBOOT.BAT - Apply updates on reboot
- CHECKUPD.BAT - Check for available updates

**Installation Location:** C:\BAT\

---

## Prerequisites

### Before You Start

1. **Network Drive Must Be Mapped**
   - T: drive must be mapped to \\D2TESTNAS\test
   - Verify by typing `T:` at DOS prompt
   - If not mapped, run: `C:\NET\STARTNET.BAT`

2. **Have Machine Name Ready**
   - Know this machine's identifier (e.g., TS-4R, TS-7A, TS-12B)
   - Machine name must match folder structure on network
   - Check with supervisor if unsure

3. **Backup Current AUTOEXEC.BAT** (Optional)
   - Script will create C:\AUTOEXEC.SAV automatically
   - Manual backup: `COPY C:\AUTOEXEC.BAT C:\AUTOEXEC.OLD`

4. **Ensure Free Disk Space**
   - Need ~100 KB free on C: drive
   - Check with: `CHKDSK C:`

---

## Deployment Steps

### Step 1: Navigate to Deployment Script

```batch
T:
CD \COMMON\ProdSW
DIR DEPLOY.BAT
```

You should see DEPLOY.BAT listed. If not found, contact system administrator.

### Step 2: Run DEPLOY.BAT

```batch
DEPLOY
```

**Expected Output:**
```
==============================================================
DOS Update System - One-Time Deployment
==============================================================

This script will install the new update system on this machine.

What will be installed:
  - NWTOC.BAT   (Download updates from network)
  - CTONW.BAT   (Upload changes to network)
  - UPDATE.BAT  (Full system backup)
  - STAGE.BAT   (System file staging)
  - REBOOT.BAT  (Apply updates on reboot)
  - CHECKUPD.BAT (Check for updates)

Press any key to continue...
```

Press any key to continue.

### Step 3: Verification Phase

Script checks:

1. **T: Drive Accessible**
   ```
   [STEP 1/5] Checking network drive...
   [OK] T: drive is accessible
        T: = \\D2TESTNAS\test
   ```

2. **Deployment Files Present**
   ```
   [STEP 2/5] Verifying deployment files...
   [OK] All deployment files found on network
        Location: T:\COMMON\ProdSW\
   ```

If either check fails, script stops with error message.

### Step 4: Enter Machine Name

```
[STEP 3/5] Configure machine name...

Enter this machine's name (e.g., TS-4R, TS-7A, TS-12B):

Machine name must match the folder on T: drive.
Example: If this is TS-4R, there should be T:\TS-4R\

Machine name: _
```

**Enter your machine name** (e.g., TS-4R) and press Enter.

**Expected Output:**
```
[OK] Machine name: TS-4R

Checking for T:\TS-4R\ folder...
[OK] Machine folder ready: T:\TS-4R\
```

Script creates the folder on network if it doesn't exist.

### Step 5: File Installation

```
[STEP 4/5] Installing update system files...

Backing up AUTOEXEC.BAT...
[OK] Backup created: C:\AUTOEXEC.SAV

Copying update system files to C:\BAT\...
  [OK] NWTOC.BAT
  [OK] CTONW.BAT
  [OK] UPDATE.BAT
  [OK] STAGE.BAT
  [OK] CHECKUPD.BAT

[OK] All update system files installed
```

### Step 6: AUTOEXEC.BAT Update

```
[STEP 5/5] Updating AUTOEXEC.BAT...

[OK] Added to AUTOEXEC.BAT: SET MACHINE=TS-4R
```

Script adds `SET MACHINE=TS-4R` to your AUTOEXEC.BAT file.

### Step 7: Deployment Complete

```
==============================================================
Deployment Complete!
==============================================================

The DOS Update System has been installed on this machine.

Machine name: TS-4R
Backup location: T:\TS-4R\BACKUP\
Update location: T:\COMMON\ProdSW\

==============================================================
Available Commands:
==============================================================

NWTOC      - Download updates from network
CTONW      - Upload local changes to network
UPDATE     - Backup entire C: drive to network
CHECKUPD   - Check for available updates

==============================================================
Next Steps:
==============================================================

1. REBOOT this machine to activate MACHINE variable
   Press Ctrl+Alt+Del to reboot

2. After reboot, run NWTOC to download all updates:
   C:\BAT\NWTOC

3. Create initial backup:
   C:\BAT\UPDATE

==============================================================

Deployment log saved to: T:\TS-4R\DEPLOY.LOG

Press any key to exit...
```

---

## Post-Deployment Steps

### 1. Reboot Machine

**REQUIRED:** You must reboot for MACHINE variable to take effect.

```
Press Ctrl+Alt+Del
```

Wait for machine to restart and DOS to load.

### 2. Run Initial NWTOC

After reboot, download all available updates:

```batch
C:\BAT\NWTOC
```

**Expected Output:**
```
==============================================================
Download: Network to Computer (NWTOC)
==============================================================
Machine: TS-4R
Source: T:\COMMON\ProdSW and T:\TS-4R\ProdSW
Target: C:\BAT, C:\ATE
==============================================================

[1/2] Downloading shared updates from COMMON...
      [OK] Shared updates downloaded

[2/2] Downloading machine-specific updates...
      [OK] Machine-specific updates downloaded

==============================================================
Download Complete
==============================================================
```

### 3. Create Initial Backup

Backup your current system state:

```batch
C:\BAT\UPDATE
```

This creates a full backup of C: drive to T:\TS-4R\BACKUP\.

**WARNING:** First backup can take 15-30 minutes depending on data size.

---

## Daily Usage

### Checking for Updates

```batch
CHECKUPD
```

Shows available updates without downloading them.

### Downloading Updates

```batch
NWTOC
```

Downloads and applies updates from network. Run this:
- At start of shift
- After supervisor announces new updates
- When CHECKUPD shows updates available

### Uploading Changes

```batch
CTONW
```

Uploads your local changes to network (machine-specific location).

```batch
CTONW COMMON
```

Uploads to COMMON location (affects all machines - requires confirmation).

### Creating Backup

```batch
UPDATE
```

Creates full backup before making changes.

---

## Troubleshooting

### ERROR: T: drive not available

**Problem:** Network drive not mapped.

**Solution:**
```batch
C:\NET\STARTNET.BAT
```

Or manually map:
```batch
NET USE T: \\D2TESTNAS\test /YES
```

### ERROR: MACHINE variable not set

**Problem:** AUTOEXEC.BAT not updated or machine not rebooted.

**Solution:**
1. Check AUTOEXEC.BAT contains: `SET MACHINE=TS-4R`
2. If missing, add line manually
3. Reboot machine: `Ctrl+Alt+Del`

Or set temporarily:
```batch
SET MACHINE=TS-4R
```

### ERROR: Deployment files not found on network

**Problem:** Files not synced from AD2 to NAS yet.

**Solution:**
- Wait 15 minutes (sync runs every 15 minutes)
- Contact system administrator

### ERROR: Could not backup AUTOEXEC.BAT

**Problem:** C: drive may be write-protected or full.

**Solution:**
- Check disk space: `CHKDSK C:`
- Continue deployment anyway (Choose Y when prompted)
- Backup AUTOEXEC.BAT manually after deployment

### WARNING: MACHINE variable already exists

**Problem:** DEPLOY.BAT was run before.

**Solution:**
- Check current AUTOEXEC.BAT for existing MACHINE variable
- Choose Y to update, N to skip
- If updating, manually edit AUTOEXEC.BAT to change value

---

## File Locations

### Local Machine (DOS)
```
C:\BAT\              - Update system batch files
C:\ATE\              - Application programs and data
C:\AUTOEXEC.BAT      - Startup configuration (modified)
C:\AUTOEXEC.SAV      - Backup of original AUTOEXEC.BAT
```

### Network (T: Drive)
```
T:\COMMON\ProdSW\    - Shared updates (all machines)
T:\TS-4R\ProdSW\     - Machine-specific updates
T:\TS-4R\BACKUP\     - Machine backups (created by UPDATE.BAT)
T:\TS-4R\DEPLOY.LOG  - Deployment log
```

### Backend (Automatic Sync)
```
AD2: C:\Shares\test\COMMON\ProdSW\      - Source for shared updates
AD2: C:\Shares\test\TS-4R\ProdSW\       - Source for machine-specific
NAS: /mnt/raid1/ad2-test/               - D2TESTNAS storage
```

---

## Deployment Checklist

Use this checklist when deploying to each machine:

- [ ] Network drive T: is mapped and accessible
- [ ] Know machine name (TS-4R, TS-7A, etc.)
- [ ] Run DEPLOY.BAT from T:\COMMON\ProdSW\
- [ ] Enter machine name when prompted
- [ ] Wait for all files to copy successfully
- [ ] Verify deployment complete message
- [ ] Reboot machine (Ctrl+Alt+Del)
- [ ] After reboot, run C:\BAT\NWTOC
- [ ] Verify updates downloaded successfully
- [ ] Run C:\BAT\UPDATE to create initial backup
- [ ] Verify backup created on network (T:\TS-4R\BACKUP\)
- [ ] Test CHECKUPD command
- [ ] Document deployment in system log

---

## Deployment Status Tracking

### Machines Deployed

| Machine | Date | Status | Notes |
|---------|------|--------|-------|
| TS-4R | 2026-01-19 | Testing | Pilot deployment |
| TS-7A | | Pending | |
| TS-12B | | Pending | |
| ... | | | |

**Update this table as machines are deployed.**

---

## Rollback Procedure

If deployment causes issues:

### 1. Restore AUTOEXEC.BAT

```batch
COPY C:\AUTOEXEC.SAV C:\AUTOEXEC.BAT /Y
```

### 2. Remove Batch Files

```batch
DEL C:\BAT\NWTOC.BAT
DEL C:\BAT\CTONW.BAT
DEL C:\BAT\UPDATE.BAT
DEL C:\BAT\STAGE.BAT
DEL C:\BAT\CHECKUPD.BAT
```

### 3. Reboot

```
Ctrl+Alt+Del
```

### 4. Report Issue

Contact system administrator with:
- Machine name
- Error messages seen
- When the issue occurred
- T:\TS-4R\DEPLOY.LOG contents

---

## Support Contacts

**System Administrator:** [Your contact info]
**Deployment Issues:** Check T:\TS-4R\DEPLOY.LOG first
**Network Issues:** Verify T: drive with `NET USE`

---

## Appendix: Behind the Scenes

### How Updates Flow

1. **System Administrator** copies files to AD2 (\\192.168.0.6\C$\Shares\test\)
2. **AD2 Sync Script** runs every 15 minutes, pushes to NAS
3. **NAS** makes files available via T: drive to DOS machines
4. **DOS Machines** run NWTOC to download updates
5. **Users** run CTONW to upload machine-specific changes

### Sync Schedule

- **AD2 → NAS:** Every 15 minutes (Sync-FromNAS.ps1)
- **Maximum Propagation Time:** 15 minutes from AD2 to DOS machine
- **Sync Status:** Check T:\_SYNC_STATUS.txt for last sync time

### File Types

**Batch Files (.BAT):** Update system commands
**Executables (.EXE):** Application programs
**Data Files (.DAT):** Configuration and calibration data
**Reports (.TXT):** Test results uploaded from DOS machines

---

**Deployment Version:** 1.0
**Script Location:** T:\COMMON\ProdSW\DEPLOY.BAT
**Documentation:** D:\ClaudeTools\DOS_DEPLOYMENT_GUIDE.md
**Last Updated:** 2026-01-19
