This article gathers together some useful active directory PowerShell scripts for you to use in your daily work.
To make it easy to find the script, we have divided the list into categories.
Note: This script list was compiled based on the scripts recommended by most MSP users and the kind help of Dor Amit (MCT, MCSE SECURITY, CITP BI, Comptia Security+, MCITP SHAREPOINT).
This list is for information purposes only. Atera does not endorse, guarantee or make any warranty regarding the scripts listed below or provide any support for them. You are responsible for deciding which scripts to use, whether a script is appropriate to achieve your intended results, and for using scripts correctly. We recommend testing all scripts and configurations on a test lab system before trying it in production.
In order to seamlessly run these scripts whenever you need them you should brush up on your PowerShell skills.
PowerShell is also very useful for troubleshooting so it is worth investing the time needed to learn this powerful scripting tool.
Click here to learn how to run PowerShell scripts using the Atera agent.
Active Directory Powershell Scripts
- Get Inactive Computer in Domain based on Last Logon Time Stamp
- How to send account lockout email notification
- Create Active Directory Reports in Excel using PowerShell
- Powershell Script to export Active Directory users to CSV
- Password Expiry Email Notification
- Reset password for all specified users
- Get Inactive User in Domain based on Last Logon Time Stamp
- List Membership In Privileged Groups
- Active Directory Installation on Windows Server 2012
- Active Directory OU Permissions Report
- Get nested group membership - function
- Active Directory Audit Report
- Active Directory Users attribute Administration
- List Group Members in Active Directory
- Test-Credential
- Merge User and Contact Object
- Dump AD OU Structure Script
- Clean Startup Folder
- Sync-OUsAndGroups
- Disable or Enable Global Catalog on DC based on entered name
Database
- Retrieve SQL Server Information (HTML Report)
- Export of all SSRS reports data sources and resources
- Get-SQLInstance
- Create Inventory of SQL Server in Network as Html
Exchange
- Get Exchange 2010 Mailbox size for all Mailboxes, output to CSV
- Office 365 Licensing Report
- Removing Duplicate Items from a Mailbox
- Generate Reports for Exchange ActiveSync Device Statistics
- Generate Mailbox Size and Information Reports
- Generate Health Report for an Exchange Server 2016/2013/2010 Environment
- ActiveSyncReport script
- Export all distribution Group and All members using PS Script-Exchange 2007&2010
- ConvertFrom-LdapFilter
- Troubleshoot Exchange 2010 Mailbox Servers
- Generate Antivirus Exclusions for Exchange 2013 and 2016 Servers
- Export Exchange Message Tracking Logs to Excel
Hardware
- Get Server Inventory: CPU, Memory, and OS information. Export to CSV
- Get Dell Server Hardware Health with Powershell
- Capture HP ILO information
- View BIOS Settings on Lenovo devices
- Determine UEFI or Legacy BIOS
- Get-FailingDrive
- Out-of-Band Hardware Management Module
- Get-HardwareProfile
- Dell Service Tag
- List Memory Slot Information for a remote computer
Local Account Management
- Remove-LocalProfile
- Get-LocalGroupMembership
- Set user password on remote or local machines
- Reset Local Administrator password
- Retrieve all local user accounts information on remote computers
- Add AD User/Group to Local Administrator Group
- Local Account Management Module 2.1
Log and Monitoring
Networking
Office 365
- List all Distribution Groups and their Membership in Office 365
- OneDriveMapper automatically maps your OneDrive for Business upon login
- Export Office 365 User Last Logon Date to CSV File
Operating System
- Get-RemoteProgram Get list of installed programs on remote or local computer
- Determine if a computer is virtual
- Script to migrate scheduled tasks from Windows XP/Server 2003 to 7/Server 2008
- Excel and HTML Asset Reports With Powershell
- Cryptowall active alerter / scanner
- Windows System Inventory Script with PowerShell
- Get scheduled tasks from remote computer
- How to create home folder and grant the appropriate permission to users
- Get product keys of local and remote systems
- Check for hung or stopped services
Printing
- Printers Inventory
- Print Server Management
- PowerShell Print Logger
- Check if the network printer is connected
- Migration of Printers From Old Print Server to New Print Server
- Add Printer Permission
- Add printers to a PC/computer based on computer group membership in AD
- Remove All Network Printers
Remote Desktop Services
Security
SharePoint
- Download and Install SharePoint 2013 Prerequisites on Windows Server 2012
- Copy all SharePoint Files and Folders Using PowerShell
Using the internet
- Switch IE Proxy
- Get Network NTP Time
- Open Internet Explorer, Login to a Website, and then Launch an executable
Windows Azure