For Network Administrators ·
What you'll accomplish
You'll set up ChatGPT Plus as your scripting partner and build a workflow for generating, storing, and reusing PowerShell and Bash scripts that solve real admin tasks. Instead of writing the same scripts from scratch or hunting through old files, you'll have a consistent, tested approach to generating quality scripts — and a habit of saving and annotating the best ones for reuse.
What you'll need
What you should see: The model selector at the top of the chat window shows you have access to the latest model.
The best scripts come from giving ChatGPT your environment context upfront. Create a context template you paste at the start of scripting sessions:
I'm a Windows/Linux system administrator. My environment:
- Windows: Active Directory domain "[domain.local]", Windows Server 2022 DCs, mixed 2019/2022 member servers
- Exchange Online / M365 tenant
- VMware vSphere 8.0 environment with ~[number] VMs
- PowerShell 7.x preferred, but 5.1 compatible required for all scripts
- All scripts should: include try/catch error handling, write to a log file at C:\Logs\, use -WhatIf for destructive operations, add a timestamp to all output
Customize this for your actual environment and save it in a text file for reuse.
Be specific about what you want. A detailed request produces a production-ready script; a vague request produces a skeleton you have to finish yourself.
Good request:
Write a PowerShell script that:
- Gets all AD users where PasswordLastSet is older than 365 days AND account is still enabled
- Excludes members of the ServiceAccounts and AdminAccounts groups
- Exports to C:\Reports\StalePasswords_[date].csv with columns: Name, SamAccountName, Department, Email, PasswordLastSet, LastLogonDate
- Sends an email summary to admin@company.com with count and attachment
- Logs all actions to C:\Logs\StalePassword.log with timestamps
What you should see: A complete, commented PowerShell script that handles all your requirements, with the exact columns, log format, and email functionality specified.
After receiving a script, always ask:
Explain each section of this script in plain English. Are there any edge cases I should test? What could cause it to fail or produce incorrect results?
What you should see: A section-by-section explanation that helps you understand what you're about to run. This also reveals any gaps or assumptions the script makes.
-WhatIf first if it supports it, or test against a small OU before running enterprise-wideWhat you should see: A corrected version of the specific section that had the problem — not a full rewrite.
For every script that passes testing, save it with:
Get-StalePasswords-Report-v1.ps1Script inventory columns:
| Script Name | What It Does | When to Run | Permissions Needed | Last Tested |
|---|
For the script types you request most often, create template prompts:
[BULK USER] Write a PowerShell script that [operation] for all users in [OU/group]. Include: error handling, logging, email summary, -WhatIf parameter. Export to CSV.
[HEALTH CHECK] Write a PowerShell script that checks [resource] on [scope: all servers / specific list] and alerts if [condition]. Log results. Send email if issues found.
[CLEANUP] Write a PowerShell script that identifies and [action: removes / reports on / disables] [object type] matching [criteria]. Run as report-only by default, add -Execute flag to make changes.
Save these templates alongside your completed scripts.
AD cleanup report:
Write a PowerShell script that finds all [AD objects: users/computers/groups] where [condition: inactive / stale / misconfigured]. Export to CSV with [columns]. Send email summary. Exclude [any exceptions]. Log to C:\Logs\.
Server health check:
Write a PowerShell script that checks [metric: disk space / CPU / memory / service status] on servers from a list file. Alert if [threshold]. Format results as HTML email. Schedule-safe (no interactive prompts).
User lifecycle operation:
Write a PowerShell script to [operation: disable / delete / move / reset] AD accounts that meet [criteria]. Require -WhatIf for safe testing. Log all changes. Send summary email.
Backup verification:
Write a PowerShell script that checks [backup solution: Veeam / Windows Backup] for jobs that failed or haven't run in [timeframe]. Send alert email with job name, last run, and status. Log results.