Script repository
Disable mail forwarding if forwarding address matches regular expression
The script disables mail forwarding for an Exchange mailbox if the forwarding address matches a regular expression.
Check whether user performing an operation manages the OU where target object is located
The script checks whether the user performing an operation manages the OU where the target object is located.
Provision shared and room mailboxes
These scripts show how to provision resource mailboxes in Exchange On-Premises.
Check whether automatic replies are enabled
The script checks whether an Exchange mailbox is configured to send automatic replies (OOF messages).
Update attributes based on value of another attribute
The script updates attributes based on the value of another attribute.
Send mail to parent container owner
The script sends an email notification to the owner of the container where the target object is located.
Copy folder structure with permissions
The script copies all the items from the source folder to the target folder keeping the permissions.
Update mailbox time zone
The script updates the time zone of a mailbox in on-premise Exchange.
Send notification to everybody who has Full Access to mailbox
The script sends an email notification to everybody who has Full Access to the target mailbox.
Check whether Microsoft 365 user account is blocked
The script check whether a user is blocked from signing in to Microsoft 365 (Office 365).
Cancel user creation if there are no available Microsoft 365 licenses
The script cancels creation of a new user if there are no available Microsoft 365 (Office 365) licenses in the specified plans of the tenant associated with the user.
Copy group memberships from template based on property values
The script copies group memberships from a template user to the current user. The template is selected based on the value of the specified properties. Original memberships of the user are removed.
Check if number of unused Microsoft 365 licenses is below limit
The script returns true if the number of Microsoft 365 licenses is below limit.
Update user picture in resource domain
The script updates a user picture in the resource domain after it is changed in the primary domain.
Remove Direct Reports from manager
This script removes Direct Reports from a manager.
Update country code and country name
This script automatically updates the Country Name and Country Code attributes based on a 2-letter country code specified for Country.
Check whether Employee ID is present in SQL Database
This script checks whether an Employee ID specified for a new user in Active Directory is present in the user's record from an SQL HR database.
Create Remote Desktop Services profile folder
A script to create a Remote Desktop Services profile folder for a user on the file system.
Move large home folders
The built-in 'Move Home Directory' action can fail on large directories if the operation takes more than 10 minutes to complete. This PowerShell code works around this issue by creating a separate process to move a home folder.
Delete/Purge user profile folder
Scripts to delete or purge a user's profile folder.