Smarter Week

How to automate it

How to automate “write PowerShell, Bash or Python scripts for admin jobs”

Here are 2 ways to spend less time on this, best first. Each comes with steps you can follow today and, for AI fixes, a prompt to copy.

60 min
typically, once a week
60%
of the time can be automated
Easy
to set up

Fix 1 of 2

AIBest fix

Have AI write and explain admin scripts, then test them safely

AI writes PowerShell, Bash and Python admin scripts quickly, including Microsoft Graph and Google Admin API calls. Always run them against a test group first.

Typically saves about 50% of the time5 min to set up
  1. 1Describe the job, the platform and the inputs using the prompt below.
  2. 2Read the script and the explanation; ask it to add a dry-run mode.
  3. 3Run it against a test user or group first.
  4. 4Save it in a shared repo with a short README.
Prompt to copy
Write a [POWERSHELL / BASH / PYTHON] script that [WHAT IT SHOULD DO] in [PLATFORM, e.g. Microsoft 365 via Microsoft Graph]. Inputs: [CSV, PARAMETERS]. Requirements: a -WhatIf or dry-run mode, logging to a file, clear error handling, and no hard-coded credentials. Explain each section briefly and list the permissions it needs.

Tools: ChatGPT, Claude, Gemini or Microsoft Copilot · Claude Code, OpenAI Codex, Cursor, GitHub Copilot agent mode or Devin Desktop (ex-Windsurf)

Fix 2 of 2

AI

Hand well-scoped tasks to a coding agent and review its pull request

Coding agents like Claude Code, OpenAI Codex, Cursor's agent and GitHub Copilot's coding agent can read the repo, make multi-file changes and run the tests. They do best on clear, bounded tasks you can review quickly.

Typically saves about 30% of the time30 min to set up
  1. 1Check which coding agent your company approves and that it has access to the repo.
  2. 2Add a short instructions file to the repo (CLAUDE.md, AGENTS.md or .cursor/rules) with how to build, test and the conventions to follow.
  3. 3Give it a ticket-sized task with acceptance criteria, using the prompt below.
  4. 4Let it run the tests; read the diff as carefully as a colleague's PR.
  5. 5Start with tests, refactors, small features and config changes before larger work.
Prompt to copy
Task: [WHAT TO BUILD OR CHANGE]. Context: [RELEVANT FILES OR MODULES]. Acceptance criteria: [LIST]. Constraints: follow the existing patterns in [EXAMPLE FILE], do not add new dependencies, do not change public APIs unless needed. First read the relevant code and give me a short plan. After I approve, make the change, add or update tests, run the test suite and linter, and summarize what you changed and anything you were unsure about.

Tools: Claude Code, OpenAI Codex, Cursor, GitHub Copilot agent mode or Devin Desktop (ex-Windsurf)

Who does this task

Roles in our library that list this as one of their common tasks. Each guide covers the rest of that role’s week.

HourLeak · the 8-minute work audit

How many hours does this cost you?

The free 8-minute check works out where your week goes and gives you your top fixes. The team scan does the same for everyone and adds it up, so you know which leaks to fix first.

Answers are anonymous. Leaders only see team totals.

Other common tasks for IT / Systems administrators