- ednclogs uses machineid FK instead of hostname - installedapps tracks installations (no separate edncstats table) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.6 KiB
eDNC Special Character Fix - Claude Code Instructions
Project Overview
PowerShell utility that monitors DNC folders and removes invalid special characters (0xFF) from .pun files in real-time. Deployed to CNC workstations via network share.
Technology Stack
- Language: PowerShell 5.1+
- Deployment: Network share (S:\DT\cameron\eDNC-Fix) → Local (C:\eDNC-Fix)
- Logging: ShopDB API (http://geitshopdb/api.asp)
- Version Control: Gitea (localhost:3000/cproudlock/edncfix)
IMPORTANT: After Making Changes
Always do the following after any code changes:
-
Update version numbers in ALL of these files:
eDNC-SpecialCharFix.ps1-$ScriptVersionvariable (line ~81)eDNC-SpecialCharFix.ps1-.NOTESsection Version fieldversion.ini-Version=x.x.xREADME.md- Version History table
-
Commit and push to Gitea:
cd /home/camp/projects/powershell/edncfix git add -A git commit -m "vX.X.X: Description of changes" git push -
Version format: Use semantic versioning (MAJOR.MINOR.PATCH)
- MAJOR: Breaking changes
- MINOR: New features
- PATCH: Bug fixes
File Structure
/home/camp/projects/powershell/edncfix/
├── eDNC-SpecialCharFix.ps1 # Main script
├── Run-eDNCFix.bat # Manual launcher (auto-elevates)
├── Install-ScheduledTask.ps1 # Creates Windows scheduled task
├── Deploy.bat # Copies from S: to C:\eDNC-Fix\
├── version.ini # Version file for auto-updates
├── README.md # Documentation
└── CLAUDE.md # This file
Configuration (Hardcoded)
| Setting | Value | Location |
|---|---|---|
| Watch Folder | C:\Dnc_Files\Q |
eDNC-SpecialCharFix.ps1 |
| File Filter | *.pun |
eDNC-SpecialCharFix.ps1 |
| Update Source | S:\DT\cameron\eDNC-Fix |
eDNC-SpecialCharFix.ps1 |
| API URL | http://geitshopdb/api.asp |
eDNC-SpecialCharFix.ps1 |
| Update Interval | 300 seconds (5 min) | eDNC-SpecialCharFix.ps1 |
ShopDB API Integration
The script logs events to ShopDB via the API. Reference the ShopDB API documentation at:
- ShopDB Project:
/home/camp/projects/windows/shopdb/ - API File:
/home/camp/projects/windows/shopdb/api.asp - Standards Doc:
/home/camp/projects/windows/shopdb/docs/STANDARDS.md
API Endpoint: logDNCEvent
Method: POST
URL: http://geitshopdb/api.asp
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| action | string | Yes | Must be "logDNCEvent" |
| hostname | string | Yes | PC hostname |
| eventType | string | Yes | Event type: started, cleaned, ok, failed, error, stopped |
| filename | string | No | File being processed |
| bytesRemoved | int | No | Number of bytes removed |
| version | string | No | Script version |
| message | string | No | Additional details |
| watchFolder | string | No | Folder being watched |
| fileFilter | string | No | File filter pattern |
Database Tables:
ednclogs- Event log entries (uses machineid FK to machines table)installedapps- Tracks installations (appid=79 for eDNC)
API Endpoint: getDNCStats
Method: GET
URL: http://geitshopdb/api.asp?action=getDNCStats
Returns JSON with all eDNC installations and their stats.
Deployment Workflow
- Development: Edit files in
/home/camp/projects/powershell/edncfix/ - Update versions: Bump all version numbers
- Commit: Push to Gitea
- Stage: Copy files to
S:\DT\cameron\eDNC-Fix\ - Deploy: On target PC, run
Deploy.batfrom S: drive - Install: Run
Install-ScheduledTask.ps1as Admin
Auto-Update Mechanism
Running instances check S:\DT\cameron\eDNC-Fix\version.ini every 5 minutes.
If a newer version is found, they automatically:
- Copy new files from S: to C:\eDNC-Fix\
- Restart themselves
To deploy an update to all PCs:
- Update version.ini with new version number
- Copy updated files to S:\DT\cameron\eDNC-Fix\
- Wait up to 5 minutes for auto-update
Quick Reference
Test API endpoint:
curl -X POST http://192.168.122.151:8080/api.asp \
-d "action=logDNCEvent&hostname=TESTPC&eventType=started&version=1.5.0"
Check installations:
curl "http://192.168.122.151:8080/api.asp?action=getDNCStats"
View logs in database:
SELECT l.*, m.hostname FROM ednclogs l
JOIN machines m ON l.machineid = m.machineid
ORDER BY l.created DESC LIMIT 20;