Every office has chores that are too small for a project and too tedious for a human: rename 400 scans, merge twelve monthly CSV exports, split a 200-page PDF per customer, convert old Word files, move files by date. An AI assistant can write the script, explain every line and fix the error message, so a non-developer gets a working tool in an hour instead of a ticket that waits for weeks. The AI helps write the script; the script itself then runs locally and deterministically, without AI.
Problem & value
- Today: staff repeat these chores by hand or ask the one colleague who "knows a bit of scripting"; IT tickets rank low.
- AI value: the assistant turns a description into runnable code, adds comments, logging and a dry-run mode, and explains errors. Script quality is no longer the bottleneck; checking is.
- Key point: AI is used once at build time, not per file: near-zero cost, reproducible results, no personal data in the AI service if you share only fake samples.
- Benefit figures: we have no reliable, independent figure for time saved on such chores; measure it yourself (minutes per run times runs per month).
Variants
- Office staff: Python or PowerShell run from a desktop, with IT-approved interpreter.
- Generalist IT: scheduled PowerShell for share clean-up and bulk moves (admin tasks: AUTO-020).
- Data preparation for AI: collect, deduplicate, convert (DOCX/XLSX to PDF or text), normalise file names and split large PDFs before loading them into a DMS, search or RAG system. This is often the largest hidden cost of other AI projects.
How it works
- describe chore + fake sample
- AI drafts script
- human reads explanation
- dry run on copy of data (log only)
- check result
- real run
- keep script in a shared folder/Git
- Human-in-the-loop: read the explanation, run the dry run, compare with a few hand-checked files; backup before anything that deletes or overwrites.
- Prompt pattern: state OS and versions (Windows 11, PowerShell 7 or Python 3.12), input structure, desired output, "never delete or overwrite, write a log, add a
--dry-runswitch". - Typical libraries: Python
pathlib,shutil,pandas,pypdf[3],openpyxl; PowerShellGet-ChildItem,Rename-Item,Import-Csv.
Data preparation
Which data: the files the script touches, plus a small fake or anonymised sample for the AI prompt.
Where it lives: file shares, SharePoint/OneDrive, Nextcloud, download folders, scanner output.
Typical gaps: umlauts in file names, mixed CSV delimiters and encodings (UTF-8 vs Windows-1252), duplicates, inconsistent dates, long paths, password-protected PDFs.
Preparation steps: 1. Write down 3-5 rules for the chore (naming scheme, target folder, what counts as a duplicate). 2. Copy 10-20 representative files into a test folder and replace names, amounts and personal data. 3. Include edge cases (empty files, odd encodings). 4. Take a backup or snapshot of the real folder before the first live run.
Rough share of effort: low; most time goes into rules and test folder. See GUIDE-003.
Implementation paths
Which path for whom
- SMB - Path A: a chat assistant already in the Microsoft 365 or Google Workspace licence (or a EU chat tool) writes the script; the process is standard and needs no integration beyond a folder.
- Enterprise - Path B: use the company's approved AI gateway or API with logging and policy, plus a shared script repository with review; assistants are part of the developer or IT platform.
- Developer - Path C: local models via Ollama or LM Studio for code you may not send out, with an IDE plugin; quality is good enough for chore-sized scripts.
Path A - Buy (recommended for most SMBs)
- Chat assistants: Microsoft 365 Copilot Chat, Gemini in Google Workspace, ChatGPT Business/Team, Claude Team, Le Chat from Mistral (EU provider, France). Microsoft offers an EU Data Boundary for M365 services; check the AVV and data-residency terms of each product.
- In the editor: GitHub Copilot, VS Code with a chat extension.
- Choose A when: staff are non-developers, the chore is standard and sample data can be anonymised.
Path B - Build on cloud APIs
- Code-capable models via API with EU regions or EU providers (Azure OpenAI in EU regions, Mistral API, Google Vertex AI EU, Amazon Bedrock Frankfurt).
- An n8n flow or Teams bot that wraps the prompt template and stores generated scripts for review.
- Choose B when: you need logging, central policy and a script library.
Path C - Self-host (open source)
- Models: open code models such as Qwen2.5-Coder (available in sizes 0.5B to 32B via Ollama [2]), plus newer open code models of similar size; served by Ollama, LM Studio or llama.cpp.
- Hardware: HW1 handles a 7B model for simple scripts; HW2 (16-32 GB VRAM) runs 14B-32B quantised models with better results.
- Choose C when: code or file names are confidential, or the assistant should work offline.
Path D - Custom training
Not sensible.
State of the art (2026)
- Frontier and open code models usually write correct scripts for chores of this size and can explain and refactor them.
- Failure modes: invented library functions or parameters, wrong assumptions about encodings, scripts that silently overwrite files, regex that matches too much, and code that works on 10 files but not on 10,000. Dry run, logs and backups address these.
- Environment pitfalls: PowerShell execution policy defaults to Restricted on Windows clients, and Group Policy can override local settings [1]: IT should provide an approved way to run scripts instead of users disabling it.
Shared resources & combinations
- Same code-model capability as CODE-001, AUTO-017 (macros), AUTO-019 (Power Query), AUTO-021 (regex).
- Scripts feed or follow AUTO-006, AUTO-007 and DOC-family pipelines; one shared prompt template and script folder serve all.
Effort, cost & KPIs
- Path A: about 1-4 hours per chore including testing; assistant seat cost often already paid. Setup of a shared script folder and run rules: 1-2 days once.
- Path B: 3-8 days for gateway and template; per-token cost is small.
- Path C: 1-2 days for Ollama/LM Studio on an existing machine.
- KPIs: chores automated, minutes saved per month, failed or rolled-back runs, number of scripts with owner and README.
People & change
Involve: the department lead (which chores), end users (they test), IT (interpreter, execution policy, scheduling) and IT security (code review for scripts that touch shares or credentials). The DPO is consulted when scripts process personal data such as HR or customer files; a DPIA is normally not required for the scripting itself, but an AVV (Art. 28 GDPR) with the AI vendor is (GUIDE-005, GUIDE-010).
Works council: usually no for the scripts themselves. Vendor chat tools may log user activity, and the BAG regards objective suitability for monitoring as sufficient under §87(1) no. 6 BetrVG, so co-determination applies when the company-wide assistant is introduced; §90(1) no. 3 requires timely information on AI-supported work (GUIDE-004). Public bodies involve the Personalrat.
AI literacy: Since 27 Jul 2026, Art. 4 AI Act requires providers and deployers to take measures that support the development of staff AI literacy (no guaranteed level). A 2-hour workshop on safe prompts, reading code and dry runs is a sensible start (GUIDE-006).
Communication and pilot: frame it as "your tedious chore, solved by you". Pilot with 3-5 volunteers and 5 chores; name an AI champion who owns the script library (GUIDE-008, GUIDE-009). Rule: no run on production data without dry run and a second pair of eyes (GUIDE-007).
Risks, regulation & compliance
- EU AI Act: minimal risk; Art. 4 literacy measures apply. No Annex III use.
- GDPR: do not paste real personal data into prompts; use fake samples. If real data must be shared, require an AVV, EU hosting and a no-training setting. The finished script runs locally and does not itself send data out - check that it does not call external services.
- Security: generated scripts can contain harmful commands or pull unvetted packages; review, pin package versions, never store passwords in scripts, run with least privilege (GUIDE-013).
- Business: ownerless scripts rot; GoBD-relevant files must not be altered or deleted by scripts without procedure documentation.
Getting started
- Collect 5 recurring chores and pick one with clear rules and low risk (copy, rename, merge).
- Build a fake sample folder and write the prompt using the pattern above.
- Ask the assistant to explain the script line by line and to add a dry-run and a log file.
- Run on a copy, compare with a hand-checked result, then take a backup and run live.
- Store script, prompt and README in a shared folder or Git and add it to the script register.
Sources
- Microsoft Learn - about Execution Policies (PowerShell) - https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_execution_policies
- Ollama - Qwen2.5-Coder model library (sizes 0.5b-32b) - https://ollama.com/library/qwen2.5-coder
- pypdf documentation - https://pypdf.readthedocs.io/
- Regulation (EU) 2024/1689 (AI Act) - https://eur-lex.europa.eu/eli/reg/2024/1689/oj