In this article we will be discussing how to install Microsoft Windows feature RSAT to write a basic power shell command or script to disable "Inactive" (AD) users accounts and generate a report showing "(AD) Accounts disabled, the last time they login, who's account password is set to never expire, DistinguishedName, ObjectClass, ObjectGuid, SamAccountName and there SID" . [NOTE: This Technical Blog was created to help customers asking the question,can Centrify software disable inactive (AD) Accounts and the answer is "No"]
About RSAT Powershell:
Remote Server Administration Tools (RSAT) allows analyst or administrators to remotely manage (Active Directory) using PowerShell commands or (scripts).
a.) Microsoft Windows Server 2008, 2012, 2016 (have not been tested on 2019) b.) Remote Server Administration Tools (RSAT) c.) Windows PowerShell
1.) Search/Launch “Windows PowerShell” as a “administrator” single “right click” on “Windows Powershell” and select “run as an administrator” and type the following command:
Screenshot 2 .) Installation has finish. (NOTE: The warning just tells you the role for your server is setup to receive automatic updates, because my VM is not on the internet Is why I see this message. It doesn’t impact me running RSAT PowerShell commands / scripts.)
2.) Type the following command below to find all Inactive (AD) accounts in “Windows PowerShell”:
(NOTE: If you type part of the command like “Search-“ and hit the “tab” key It will fill out the rest of the command this includes parameters)
Question, do you have a PowerShell script to query (AD) accounts (60) days Inactive? Yes, download the attach PowerShell script "SearchIAD90.ps1". The script queries (AD) Accounts that is (60) days Inactive. (NOTE: To change the days edit the variable "$days")
Question, how can I query inactiveaccounts starting from a specific day and year using a PowerShell command?
(For example, I want to specify the following date “May 6th 2020” to query all Inactive (AD) Accounts up til the day I ran the PowerShell command)