Scripting

Anonymized scripts from the workshop and the day job. Copy, adapt, break, improve.

Powershell24 lines

PowerShell: Create a Distribution List with an Array

This script creates an Exchange Online distribution group and bulk-adds members to it using a PowerShell array and a foreach loop. It’s useful when you need to stand up a new distribution list with a known set of members without clicking through the Exchange admin center one address at a time.

Read »
Text

Managing AD Groups with PowerShell

As a Windows system administrator, managing Active Directory (AD) groups is probably something you do every day. While you could use the Active Directory Users and Computers (ADUC) MMC snap-in, what happens when you need to manage groups across multiple domains or automate group management tasks? That’s where PowerShell comes in handy.

Read »
Bash640 lines

Multi-DC Active Directory Health Check Script

This PowerShell script runs a broad battery of AD health checks against every Domain Controller in your domain, either auto-discovered or passed explicitly. It pulls system info, replication state, dcdiag results, event logs, account hygiene, DNS health, and more from each DC via PSRemoting, then writes per-DC text reports and a side-by-side comparison summary. Run it when you want a fast, consistent snapshot across all DCs without clicking through multiple tools.

Read »
Powershell98 lines

PowerShell Script: Pull Domain Info from Any Domain-Joined PC

This script collects a snapshot of everything domain-related on the local machine: join status, logged-on users, secure channel health, time sync source, AD site, network config, and key AD domain details. Run it when you’re troubleshooting a domain issue and want all the relevant facts in one shot instead of running eight separate commands.

Read »
Powershell23 lines

Generate Random Passphrase Passwords with PowerShell

This script builds a random passphrase by pulling words, numbers, and special characters from CSV wordlists and concatenating them until the result hits a minimum length of 15 characters. It’s useful when you need a human-readable but policy-compliant password without reaching for a third-party tool.

Read »
Powershell142 lines

Get and Set Exchange Online Out of Office Messages with PowerShell

This script gives you an interactive menu to read and write Out of Office (automatic reply) configurations for any mailbox in Exchange Online. Use it when you need to check or update OOO messages on behalf of users, useful for helpdesk staff, onboarding/offboarding workflows, or covering for absent employees.

Read »
Vbscript62 lines

VBScript: Find and Copy PST Files Using WMI

This script scans the local machine for all PST files using a WMI query against `CIM_Datafile`, then copies whatever it finds to a destination folder you specify at runtime. It’s useful when you need to round up Outlook data files before a migration, decommission, or backup sweep — without knowing where users may have stashed them.

Read »