v1.4.0: Auto-update from network share
- Checks S:\DT\cameron\eDNC-Fix\version.ini every 5 minutes - Auto-downloads new files and restarts if newer version found - Added version.ini file - Deploy.bat now includes version.ini 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ echo Copying files...
|
|||||||
copy /Y "%~dp0eDNC-SpecialCharFix.ps1" "%DEST%\"
|
copy /Y "%~dp0eDNC-SpecialCharFix.ps1" "%DEST%\"
|
||||||
copy /Y "%~dp0Run-eDNCFix.bat" "%DEST%\"
|
copy /Y "%~dp0Run-eDNCFix.bat" "%DEST%\"
|
||||||
copy /Y "%~dp0Install-ScheduledTask.ps1" "%DEST%\"
|
copy /Y "%~dp0Install-ScheduledTask.ps1" "%DEST%\"
|
||||||
|
copy /Y "%~dp0version.ini" "%DEST%\"
|
||||||
copy /Y "%~dp0README.md" "%DEST%\"
|
copy /Y "%~dp0README.md" "%DEST%\"
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -61,6 +61,24 @@ Default settings (edit `eDNC-SpecialCharFix.ps1` to change):
|
|||||||
| IncludeSubfolders | `$true` | Watch subdirectories |
|
| IncludeSubfolders | `$true` | Watch subdirectories |
|
||||||
| CharactersToRemove | `@(255)` | Byte values to strip (0xFF) |
|
| CharactersToRemove | `@(255)` | Byte values to strip (0xFF) |
|
||||||
|
|
||||||
|
## Auto-Update
|
||||||
|
|
||||||
|
The script automatically checks for updates every 5 minutes by reading:
|
||||||
|
```
|
||||||
|
S:\DT\cameron\eDNC-Fix\version.ini
|
||||||
|
```
|
||||||
|
|
||||||
|
**To deploy an update:**
|
||||||
|
1. Update `version.ini` with the new version number
|
||||||
|
2. Copy new files to `S:\DT\cameron\eDNC-Fix\`
|
||||||
|
3. Running instances will auto-update within 5 minutes
|
||||||
|
|
||||||
|
**version.ini format:**
|
||||||
|
```ini
|
||||||
|
[eDNC-Fix]
|
||||||
|
Version=1.4.0
|
||||||
|
```
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
|
|
||||||
The script displays real-time activity:
|
The script displays real-time activity:
|
||||||
@@ -112,6 +130,7 @@ The script uses exponential backoff (500ms → 1s → 2s → 4s → up to 16s) f
|
|||||||
|
|
||||||
| Version | Date | Changes |
|
| Version | Date | Changes |
|
||||||
|---------|------|---------|
|
|---------|------|---------|
|
||||||
|
| 1.4.0 | 2025-12-12 | Auto-update from S:\DT\cameron\eDNC-Fix\version.ini every 5 min |
|
||||||
| 1.3.1 | 2025-12-12 | Added Install-ScheduledTask.ps1 for running as SYSTEM service |
|
| 1.3.1 | 2025-12-12 | Added Install-ScheduledTask.ps1 for running as SYSTEM service |
|
||||||
| 1.3.0 | 2025-12-12 | Fixed header UI, live status/stats, auto-elevate to Administrator |
|
| 1.3.0 | 2025-12-12 | Fixed header UI, live status/stats, auto-elevate to Administrator |
|
||||||
| 1.2.1 | 2025-12-12 | Added GE Aerospace ASCII banner |
|
| 1.2.1 | 2025-12-12 | Added GE Aerospace ASCII banner |
|
||||||
|
|||||||
@@ -36,9 +36,13 @@
|
|||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: GE Aerospace - Rutland
|
Author: GE Aerospace - Rutland
|
||||||
Version: 1.3.0
|
Version: 1.4.0
|
||||||
Date: 2025-12-12
|
Date: 2025-12-12
|
||||||
|
|
||||||
|
v1.4.0 - Auto-update:
|
||||||
|
- Checks S:\DT\cameron\eDNC-Fix\version.ini every 5 minutes
|
||||||
|
- Auto-downloads and restarts if newer version found
|
||||||
|
|
||||||
v1.3.0 - Fixed header UI:
|
v1.3.0 - Fixed header UI:
|
||||||
- GE Aerospace ASCII banner stays at top
|
- GE Aerospace ASCII banner stays at top
|
||||||
- Live status updates in header (Processing, Cleaned, Failed)
|
- Live status updates in header (Processing, Cleaned, Failed)
|
||||||
@@ -74,9 +78,15 @@ param(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Script info
|
# Script info
|
||||||
$ScriptVersion = "1.3.0"
|
$ScriptVersion = "1.4.0"
|
||||||
$ScriptName = "eDNC Special Character Fix"
|
$ScriptName = "eDNC Special Character Fix"
|
||||||
|
|
||||||
|
# Auto-update settings
|
||||||
|
$UpdateSource = "S:\DT\cameron\eDNC-Fix"
|
||||||
|
$LocalPath = "C:\eDNC-Fix"
|
||||||
|
$UpdateCheckInterval = 300 # Check every 5 minutes (in seconds)
|
||||||
|
$script:LastUpdateCheck = [DateTime]::MinValue
|
||||||
|
|
||||||
# Header display function
|
# Header display function
|
||||||
function Show-Header {
|
function Show-Header {
|
||||||
param([int]$Cleaned = 0, [int]$Failed = 0, [string]$Status = "Watching...")
|
param([int]$Cleaned = 0, [int]$Failed = 0, [string]$Status = "Watching...")
|
||||||
@@ -134,6 +144,67 @@ function Show-Header {
|
|||||||
return $headerLines.Count
|
return $headerLines.Count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Auto-update function
|
||||||
|
function Check-ForUpdate {
|
||||||
|
$versionFile = Join-Path $UpdateSource "version.ini"
|
||||||
|
|
||||||
|
# Skip if source not available
|
||||||
|
if (-not (Test-Path $versionFile)) {
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Read version from INI file
|
||||||
|
$content = Get-Content $versionFile -Raw
|
||||||
|
if ($content -match 'Version=(\d+\.\d+\.\d+)') {
|
||||||
|
$remoteVersion = [version]$matches[1]
|
||||||
|
$localVersion = [version]$ScriptVersion
|
||||||
|
|
||||||
|
if ($remoteVersion -gt $localVersion) {
|
||||||
|
return $remoteVersion.ToString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Silently fail if can't read
|
||||||
|
}
|
||||||
|
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-Update {
|
||||||
|
param([string]$NewVersion)
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " [UPDATE] New version $NewVersion available!" -ForegroundColor Magenta
|
||||||
|
Write-Host " [UPDATE] Downloading update..." -ForegroundColor Magenta
|
||||||
|
|
||||||
|
try {
|
||||||
|
# Copy new files
|
||||||
|
$files = @("eDNC-SpecialCharFix.ps1", "Run-eDNCFix.bat", "Install-ScheduledTask.ps1", "version.ini")
|
||||||
|
foreach ($file in $files) {
|
||||||
|
$src = Join-Path $UpdateSource $file
|
||||||
|
$dst = Join-Path $LocalPath $file
|
||||||
|
if (Test-Path $src) {
|
||||||
|
Copy-Item -Path $src -Destination $dst -Force
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host " [UPDATE] Update complete! Restarting..." -ForegroundColor Magenta
|
||||||
|
Start-Sleep -Seconds 2
|
||||||
|
|
||||||
|
# Restart the script
|
||||||
|
$scriptPath = Join-Path $LocalPath "eDNC-SpecialCharFix.ps1"
|
||||||
|
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`"" -WindowStyle Normal
|
||||||
|
|
||||||
|
# Exit current instance
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host " [UPDATE] Update failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Initialize console
|
# Initialize console
|
||||||
Clear-Host
|
Clear-Host
|
||||||
$script:HeaderHeight = Show-Header -Status "Initializing..."
|
$script:HeaderHeight = Show-Header -Status "Initializing..."
|
||||||
@@ -313,6 +384,16 @@ $null = Register-ObjectEvent -InputObject $watcher -EventName Changed -Action $a
|
|||||||
try {
|
try {
|
||||||
while ($true) {
|
while ($true) {
|
||||||
Start-Sleep -Seconds 1
|
Start-Sleep -Seconds 1
|
||||||
|
|
||||||
|
# Periodic update check
|
||||||
|
$now = Get-Date
|
||||||
|
if (($now - $script:LastUpdateCheck).TotalSeconds -ge $UpdateCheckInterval) {
|
||||||
|
$script:LastUpdateCheck = $now
|
||||||
|
$newVersion = Check-ForUpdate
|
||||||
|
if ($newVersion) {
|
||||||
|
Invoke-Update -NewVersion $newVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
2
version.ini
Normal file
2
version.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[eDNC-Fix]
|
||||||
|
Version=1.4.0
|
||||||
Reference in New Issue
Block a user