Powershell Scripts
Powershell Scripts which can be used in production Environment
-
AD Computer-Based Scripts
Managing computer accounts in Active Directory is a key part of IT administration, helping ensure devices are properly accounted for, secure, and compliant. These scripts allow administrators to report, audit, and manage computer objects efficiently. On this page, you will find scripts for listing computers, checking activity, detecting inactive or disabled machines, organizing by OU, and monitoring connectivity. Each script is designed to be run in PowerShell, with output exportable to CSV for auditing, reporting, or operational tasks. List all computers Inactive/stale computers OS versions Last logon per computer Disabled computers Computers by OU Recently added computers
-
AD Group-Based Scripts
Active Directory groups are a fundamental part of managing permissions, access, and organizational hierarchy. These scripts help administrators report, audit, and manage AD groups efficiently. On this page, you will find scripts categorized by common use cases, including listing groups, checking membership, nested groups, inactive groups, and groups by OU. Each script can be run directly in PowerShell and exported to CSV for reporting purposes. List all Groups Group membership report Nested group membership Groups by OU Inactive groups
-
Powershell Script to Add Multiple computers to a Security Group
In most enterprise environments, managing security groups within Active Directory (AD) is a critical part of day-to-day administration. Security groups are often used to grant access to resources, apply group policies, or push software deployments in a controlled manner. While adding a single computer to a group is straightforward, things can quickly become tedious when you need to update dozens or even hundreds of machines at once. Consider a few common scenarios: In each of these cases, the manual approach—searching for every computer object in Active Directory and adding it individually—can be both time-consuming and prone to errors. This is where automation comes to the rescue. The PowerShell script provided…
-
Daily Active Directory Monitoring Made Easy with PowerShell
If you’re a Domain Admin responsible for maintaining the health of your Active Directory environment, running dcdiag and repadmin commands daily can be time-consuming. To simplify this routine task, I’ve created a PowerShell script that automates these checks and generates a clear, HTML-based report. This makes daily AD monitoring faster, easier, and far more efficient — a real time-saver for any IT admin Pre-requisites Usage Copy the Powershell code Edit the email settings in the highlighted part Run the Powershell
-
Powershell Script to Automate password Change for Scheduled Tasks
Managing scheduled tasks across multiple Domain Controllers and member servers is a routine yet critical responsibility for every Domain Administrator. Typically, these tasks are executed using Group Managed Service Accounts (gMSAs) for improved security and ease of credential management. However, when a password expires or the account is reset, manually updating credentials across numerous scheduled tasks on different servers can become a time-consuming and error-prone process. To simplify this challenge, I’ve developed a PowerShell script designed to streamline the credential update process across your environment. The script is flexible and can be customized to suit your setup — you’ll need to update variables such as the username, the list of…