Active Directory Archives - A Complete How to Guide - Get Solution to Your Queries https://www.systoolsgroup.com/how-to/category/active-directory/ Tue, 02 Dec 2025 10:43:24 +0000 en-US hourly 1 https://wordpress.org/?v=6.9 How to Check Active Directory User Login History With PowerShell https://www.systoolsgroup.com/how-to/check-user-login-history-in-active-directory/ Tue, 02 Dec 2025 03:52:42 +0000 https://www.systoolsgroup.com/how-to/?p=8685 Every once in a while, IT admins need to check in on the user activity going on inside the Active Directory. For that, they usually start by searching “How to

The post How to Check Active Directory User Login History With PowerShell appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Every once in a while, IT admins need to check in on the user activity going on inside the Active Directory. For that, they usually start by searching “How to check active directory user login history?”. This is especially true for novice administrators who have just taken over the responsibility of managing an AD. Due to their inexperience, they might think that the task is simple with the availability of PowerShell scripts.

However, that’s exactly where the problems begin. The commands you find online are not verified and are designed for a foreign system. So to help you view and check the user logon data, we have compiled the various sources within this writeup. Therefore, you no longer need to spend countless hours scouring the net. This also causes problems further down the line when admins look for answers to what is Active Directory and related questions.

Moreover, apart from the usual PowerShell code, here you also get to see a professional utility in action. Let’s first start by deconstructing the exact needs of an admin when they search for a query like this.

Table of Contents

Why do Admins Want to Get AD User Login History At All?

Admins like yourself may start finding user login data for one of the following reasons:

  • Comply with the industry regulations: Depending on the industry, admins may have to conduct a mandatory user activity checkup. This process is part of the regulatory process and must be done at a fixed frequency.
  • Perform a security check of the Active Directory: Looking at the login data of individuals admins can figure out whether or not an entry request was genuine. Moreover, if someone is trying a forced entry it is often characterized by multiple attempts from a remote location.
  • Predecessor to an employee evaluation report: Login information is an important parameter through which companies can check the productivity of their employees. Which makes it easier to help those who are falling behind their required quota.
  • Move Active Directory Objects across domains: Migrating Active Directory has become ever more common due to the increase in mergers and acquisitions. Having a list of active users helps admins fast-track this transfer which otherwise is a major project on its own.

Even though this list is not exhaustive, it covers the majority of the reasons that administrators have in their minds. So now as the reasons are out of the way let’s get straight to the PowerShell script you should use.

How to Check User Login History in Active Directory Using PowerShell? Explained

Before using the script, test it and apply modifications.

$users = Get-ADUser -Filter * -Properties LastLogonDate, LastLogonTimestamp, LastLogoff

# Create an array to store the results
$results = @()

foreach ($user in $users) {
$result = [PSCustomObject]@{
Username = $user.SamAccountName
LastLogon = $user.LastLogonDate
LastLogonTimestamp = [DateTime]::FromFileTime($user.LastLogonTimestamp)
LastLogoff = $user.LastLogoff
}
$results += $result
}

# Display the results in a table format
$results | Format-Table -AutoSize

Don’t copy-paste directly; it may not work as intended. Do the following instead.

  • Save the script as a Get-ADUserloginHistoryInteractive.ps1 file.
  • Open a PowerShell window with administrator privileges.
  • Navigate to the directory where you saved the script.
  • Run the script

login history

Moreover, despite the best efforts, these commands are not foolproof. Let’s see why this is the case.

Problems With PowerShell Command to Get User Login Details

Scripts tend to break down during edge cases. Like a situation where your Active Directory is brand new and thus has no users. This is a known situation; there might be other unknown cases that can cause the script to behave abruptly.

The PowerShell method may not give you the exact information on how to check user login history in Active Directory in one try. Making it a suboptimal way of answering how to check Active Directory user login history for any admin. Moreover, you have to continuously reiterate the command structure. Taking up a lot of time and effort for even a basic task like user login information retrieval.

Most scripts, like the one presented here, are designed for a general audience. As the AD is highly customizable, it is rarely the case that you can find a solution right away. It is recommended that as the admin you find the user location inside the Active Directory first. This is to see if or not you are checking the right domain.

Moreover, if you don’t possess the right skill set, these commands may do irreplaceable damage to the AD.

All in all, PowerShell commands don’t seem like the right way to attempt data accumulation in AD, especially if you have little to no knowledge. Not to worry, as we have just the right solution for you

Answer How to Check Active Directory User Login History by Skipping the PowerShell Script

The SysTools Active Directory Reporting Software is the best way to get a complete user login list in no time. It eliminates the need to troubleshoot complex PowerShell scripts altogether. This is done via a unique and simple-to-understand user interface. This, when combined with its fast and secure algorithms, gives administrators a considerable advantage over traditional methods.

Download Now Purchase Now

Multi-domain addition, CSV file output, and Date range filters are just some of the extra features that admins get from this utility. To use the tool flow, follow the instructions provided ahead.

Steps to Get AD User Login History in an Automated Manner

Step 1. Open the Tool and type the default “administrator” in both the User ID and password tabs. You can reset it via the tool settings later.
type administrator

Step 2. After activation, click on the “REGISTER DOMAIN CONTROLLER” button on the center of your screen.
register domain controller button

Step 3. Fill in the Domain Friendly Name and IP address in the space provided and hit Save & Continue.
register domain controller

Step 4. The tool automatically takes you to the Domain details page, where you have to enter the Actual Admin credentials and validate them. This pushes you closer to the answer of how to check Active Directory user login history than ever before.
save credentials

Step 5. Click on the Report tab to open up the reporting options. Choose the one that helps you answer how to find user login history in Active Directory. That would be the Login sub-category inside the Users section.
report tab multiple options

Step 6. The tool presents the filtering menu, where the options you chose previously are pre-selected.  You can toggle the User Workload and Login Category options and find the exact AD user data you wish to see.
user

Step 7.  Pick a specific duration there is a list of premade timelines starting from 5 days up to a year. You can select the custom option to fine-tune your results.
preset time intervals

Step 8. Click on the Preview button to generate a tabular representation of user login details.
preview

Step 9. Expand the Download Report button and select CSV to fetch your Active Directory User Login Report.
download csv

Step 10. Confirm by hitting the Download option in the popup.
download button

Step 11. A Save as screen opens from where you can select the location to put the report. Press Save.
save CSV report

Step 12. Open the CSV file on any visualizer and check the results.
view csv

Enable Event Viewer

Part 1:

Before we can track user history in Event Viewer We must enable the logon/logoff events.

  1. Press Windows + R and type “gpmc.msc” to launch the “Group Policy Management” console.
    type gpmc.msc
  2. To build a new audit for the entire domain right-click on it and select “Create a GPO in this domain, and Link it here…”.
    Create a GPO
  3. In the new GPO window add a name.
    Make a new GPO
  4. Right-click on the new GPO. Then select the Edit option.
    select the edit option
  5. Follow this path “Computer Configuration” > “Policies” > “Windows Settings” > “Security Settings” > “Local Policies” > “Audit Policy”.
  6. On the Right Pane, you will find the “Audit logon events” policy click on it twice. This opens up the property windows.
  7. Mark the box next to “Success” and “Failure” then press “OK”.
  8. Repeat for “Audit Account Logon Events” policy as well.
  9. Close the GPME.
    audit account logon events

Part 2:

Now add this GPO to the AD objects for that.

  1. Reopen the Group Policy Management Console and pick the new GPO
  2. Go to the “Security Filtering” tab in the right panel, and click “Add”.
    security filtering tab
  3. Doing this opens the “Select User, Computer or Group” dialog box.
  4. Enter “Everyone”. Click on “Check Names” and validate. After that click “OK” to first add it and then apply it to all objects.
    enter everyone
  5. Close the “Group Policy Management Console”.
  6. Force the update with the help of gpupdate /force command.
    use gpupdate /force command

How to Check User Login History in Active Directory With Event Viewer Portal?

Open Event Viewer > Toggle Windows Logs > Select Security and use the Find option to search for these Event IDs:

Event ID 4624 – Successful account logon: If you see this code then it means that login was successful on the local computer. You can see the logon type and username involved along with the rest of the network information. Admins should check this event regularly to see who enters into the AD as this information is not present on the Domain Controllers.
event 4624

Event ID 4625 – Failed account logon: As the name suggests admins can get the AD user login history of a failed login attempt with its cause e.g., bad password. While you are at it, check the user password expiration date, too. Admins look for this Event ID during the security audits.
event 4625

Event ID 4634 – Account logoff: Whenever this code appears on the Event Viewer it indicates that a user login session came to an end and that they logged off from the Active Directory. This event cannot trigger for a user who didn’t record a 4624 ID earlier.
event 4634

Event ID 4647 – User-initiated logoff: This Event ID is like the regular logoff (4634) with one key difference being that the logoff was interactive. This can also be triggered in case of a logoff from a Remote interactive session.

Event ID 4648 – User Logon With Explicit Credentials: It is the type of Event ID that is associated whenever a process attempts to log in to a user account by utilizing its explicit credentials. It is a common occurrence in the case of batch configuration and/or RUNAS command.
event 4648

All Event IDs in the form of 46XX are pulled from the workstations directly.

Here is a small flow chart that indicates a user login event and its various outcomes.

Flow Chart to Form a Manual Active Directory User Logon/Logoff Report via PowerShell

Flow chart

First up ensure that the user account exists, no login attempt successful or otherwise can be made if there is no user account to begin with.

Once the existence of a user account is confirmed the next step is to see if the user has attempted a login or not. There are instances where not a single login event is made from the user side, so no event ID is generated that’s why admins need to filter out those Dormant accounts to avoid confusion.

Next, the actual process begins when a user tries to log in. Even the most basic form of AD security requires credential validation. So user needs to put in the given credentials or continue with the old one.

After this one of two outcomes might happen either the credentials are validated or they are not.

In the case of the former (valid credentials) a secondary check is made to ensure that the user account is not expired or disabled from the admin end.

The enabled users get access to all AD resources.

However, if during the system checks, any of the credentials (username, password, or both) mismatch from the database then the user cannot log in.

Depending on the group policy users may have 3 – 5 attempts to re-enter the correct credentials after which they automatically lockout (temporarily or permanently). The user requires admin intervention from here on.

From this, we form the following PowerShell script.

# Define variables
$userName = "username" # Replace with the actual username to check
$maxLoginAttempts = 5 # Replace with the actual maximum allowed login attempts

# Function to check if a user account exists
function Check-UserAccountExists {
param ($userName)
$user = Get-ADUser -Identity $userName -ErrorAction SilentlyContinue
if ($null -ne $user) {
return $true
}
return $false
}

# Function to check if the user has attempted to log in
function Check-UserLoginAttempts {
param ($userName)
$logonEvents = Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4624} | Where-Object { $_.Properties[5].Value -eq $userName }
if ($logonEvents.Count -gt 0) {
return $true
}
return $false
}

# Function to validate user credentials
function Validate-Credentials {
param ($userName, $password)
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($userName, $securePassword)
try {
$null = (New-Object System.DirectoryServices.DirectoryEntry("", $cred.Username, $cred.GetNetworkCredential().Password)).nativeObject
return $true
}
catch {
return $false
}
}

# Function to check if the account is expired or disabled
function Check-AccountStatus {
param ($userName)
$user = Get-ADUser -Identity $userName -Properties AccountExpirationDate, Enabled
if ($user.Enabled -and ($null -eq $user.AccountExpirationDate -or $user.AccountExpirationDate -gt (Get-Date))) {
return $true
}
return $false
}

# Function to handle login attempts and lockout policy
function Handle-LoginAttempts {
param ($userName, $password)
$attempts = 0
while ($attempts -lt $maxLoginAttempts) {
if (Validate-Credentials -userName $userName -password $password) {
if (Check-AccountStatus -userName $userName) {
Write-Host "Access granted to AD resources."
return
} else {
Write-Host "Account is expired or disabled."
return
}
} else {
$attempts++
Write-Host "Invalid credentials. Attempt $attempts of $maxLoginAttempts."
}
}
Write-Host "Account locked out. Please contact admin for intervention."
}

# Main script logic
if (Check-UserAccountExists -userName $userName) {
if (Check-UserLoginAttempts -userName $userName) {
$password = Read-Host -AsSecureString "Enter Password"
Handle-LoginAttempts -userName $userName -password $password
} else {
Write-Host "No login attempts detected. Account is dormant."
}
} else {
Write-Host "User account does not exist."
}

Conclusion

In this writeup, we have given users the answer for how to check Active Directory user login history. Moreover, users can view logon data reports with or without PowerShell, choosing the approach that suits them best. All we can say is that, from the evidence we have listed here, it is safe to say that the tool is easier and faster. It outperforms the traditional script-based approach and so experts recommend it too.

Frequently Asked Questions on AD User Login Tracking

What can be the reasons for an invisible user login history in our Active Directory?

  • Checking in the wrong domain
  • Users didn’t log in
  • Event Viewer Issues

The PowerShell command shows a user login event but the user was on leave how is it possible?
IT admins approach login and logoff events in AD PowerShell modules with skepticism, as they are infamous for potential inaccuracies. Moreover, noise from parallelly running network sessions can also result in many false positives.
We can hope for a partial remedy by constructing centralized logs in the built-in Windows Event Forwarding. This can correlate with AD data to add insights you receive from the professional tool which can help admins to reduce false positive login events by a significant margin.

Why am I unable to check user logoff data in the Active Directory?
Every user must be logged in at the moment. Moreover, it’s a known issue that AD is somewhat unreliable in tracking when exactly the users log in. As its primary focus is on monitoring login

Is there a way to check user login history in Active Directory from command line?
Yes you can use the query

net user /domain

To list every user on the domain then use

net user %username% /domain | findstr /C:"Last logon"

check login history

Replace the %username% variable with the user name whose login data you require. This method seems simple however, the catch is that you can only see when the user logs in but not when they log out.

The post How to Check Active Directory User Login History With PowerShell appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Find Disabled Computers in Active Directory via PowerShell https://www.systoolsgroup.com/how-to/find-disabled-computers-in-active-directory/ Mon, 25 Aug 2025 10:45:38 +0000 https://www.systoolsgroup.com/how-to/?p=8695 Organisations that use AD must maintain it regularly. Moreover, this maintenance requirement report can’t be complete unless admins have an answer on how to find disabled computers in Active Directory

The post Find Disabled Computers in Active Directory via PowerShell appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Organisations that use AD must maintain it regularly. Moreover, this maintenance requirement report can’t be complete unless admins have an answer on how to find disabled computers in Active Directory using PowerShell. The good news is that there is more than one way in which admins can identify the dormant devices, including PowerShell, Command Line, ADUC, and more.

However, the presence of so many approaches only adds to the confusion. Moreover, it may just be the first phase of a larger question of what is Active Directory migration. So, to avoid any delay in segregating a list of defunct machines, it is better to rely on a guide. That is exactly what this write-up provides. Before we move on to the best solution, let us see the reasons that trigger a sudden demand to check the computers that are no longer in use.

Table of Contents

Why Find Old Computers in Active Directory at All?

Behind every reason is the need to maintain Active Directory hygiene, be it this or the Active Directory group membership report. Here is a list of the most common reasons for you to check and match:

  • Strengthen Security: With fewer vulnerable devices, administrators can reduce the attack surface that any potential adversary might use to infiltrate the AD. Thereby improving the security posture of the organisation.
  • Enhance Efficiency: Defunct computer objects only bog down the live infrastructure. If admins have a list of all inactive computers, they can remove them and bring back speed in the day-to-day operations.
  • Allow Auditing: Organisations often have to undergo compliance checks. If, during these checks, regulators find a large number of inactive machines, this only raises suspicion. To avoid any legal trouble, admins have to find these inactive computers beforehand.

Now that the reasons are out of the way, let’s get to the methods.

How to Find Disabled Computers in Active Directory Using PowerShell?

For those who prefer command-line interfaces and automation, PowerShell offers robust capabilities to manage Active Directory,  and also, using it, you can easily find disabled computers in your AD environment.

Here’s how:

Launch a new PowerShell module and type:

Get-ADComputer -Filter "Enabled -eq 'false'"
Select Name, Enabled <# Add Other attributes you wish to see #>

PowerShell Output

For a more in-depth result, use the following script:

# Import the Active Directory module
Import-Module ActiveDirectory

# Define the thresholds for inactive computers (e.g., 90 days)
$inactiveThreshold = (Get-Date).AddDays(-90)

# Fetch all computer objects from Active Directory
$computers = Get-ADComputer -Filter * -Property Name, DistinguishedName, Enabled, LastLogonDate

# Initialize arrays to hold categorized computer objects
$normalComputers = @()
$inactiveComputers = @()
$disabledComputers = @()

# Categorize the computer objects
foreach ($computer in $computers) {
if (-not $computer.Enabled) {
$disabledComputers += $computer
} elseif ($computer.LastLogonDate -lt $inactiveThreshold) {
$inactiveComputers += $computer
} else {
$normalComputers += $computer
}
}

# Function to create a custom object for export
function Create-CustomObject {
param (
[array]$Computers,
[string]$Category
)
$result = @()
foreach ($computer in $Computers) {
$obj = [PSCustomObject]@{
Name = $computer.Name
DistinguishedName = $computer.DistinguishedName
Category = $Category
}
$result += $obj
}
return $result
}

# Combine all results
$allResults = @()
$allResults += Create-CustomObject -Computers $normalComputers -Category "Normal"
$allResults += Create-CustomObject -Computers $inactiveComputers -Category "Inactive"
$allResults += Create-CustomObject -Computers $disabledComputers -Category "Disabled"

# Export to CSV
$csvPath = "C:\Users\Administrator\Desktop\ADComputerCategories.csv"
$allResults | Export-Csv -Path $csvPath -NoTypeInformation

# Function to display the results in a colored table
function Show-Results {
param (
[array]$Computers,
[string]$Category,
[string]$Color
)

Write-Host "$Category Computers:" -ForegroundColor $Color
$Computers | Format-Table Name, DistinguishedName, @{Name="Category"; Expression = {$Category}} -AutoSize
Write-Host ""
}

# Display the results
Show-Results -Computers $normalComputers -Category "Normal" -Color "Green"
Show-Results -Computers $inactiveComputers -Category "Inactive" -Color "Yellow"
Show-Results -Computers $disabledComputers -Category "Disabled" -Color "Red"

Write-Host "Results exported to $csvPath"

PowerShell Script Output
If you have AD Users and a computer (MMC) on your AD, then you may also use it to get the data.

Report and List Inactive Computer Accounts in Active Directory with ADUC

As we learned how to find disabled computers in Active Directory using PowerShell. However, one of the most straightforward methods to find it is by using the Active Directory Users and Computers (ADUC) management console.

Follow these Steps:

  • Launch ADUC > Click on View > Enable Advanced Features
  • Show all Domain Objects > Go to Computers
  • Right-click on the computer you suspect of being inactive or disabled.
  • Select the Properties option from the Context Menu.
  • In the Properties Dialogue box, go to the Attribute Editor TabAttribute Editor
  • Search for the following Attributes:
    • lastLogon: Displays the time within 100-nanosecond intervals once the user enters the domain and uses this computer object. Calculated from the user activity automatically
    • lastLogoff: Displays the time when user activity stopped on this computer
    • lastLogonTimestamp: Calculated after putting the login time in the admin-defined starting point.
    • userAccountControl: When you click on the “userAccountControl” attribute, you will see one of two integer values: 4128 for an enabled account and 4130 for a disabled one. These directly correspond to the flags that you see, where 0x00001022 = (ACCOUNTDISABLE) tells you everything you need to know. If you don’t see this, then the computer object is available for use.
      The presence of the digit “2” in the left-most place indicates that the object is disabled.

Another direct GUI-based way to check the computer status is through the Active Directory Admin Center. Moreover, if the ADUC snap-in is not present, this might be the only default way available that does not involve code.

Steps to Find Old Computers in Active Directory using Admin Center

  • Search for Admin Center using the Windows Search bar or open it via the Tools Menu in Server Manager.
  • In the ADUC portal, check if the “Computers” container is present below the domain name. If positive, then click on it; otherwise, click on the black arrow and choose Computers from the Context menu.
    choose Computers from the Context menu
  • When the Computers are visible, click on them and look at the Tasks pane.
  • The defunct computers are marked as (disabled), whereas enabled computers just display their name.
  • To see inactive or old computers that have not been used in a while, select a computer and click on Properties.
  • Toggle the Extensions tab > Select Attribute Editor > Check for the same Attributes that we mentioned during the above ADUC tutorial.
    Disabled Computer in ADAC

Legacy Techniques to Find Stale Computer Objects in AD

If you operate an older version of Windows Server, then the command line will suffice. It is similar to the one used to find locked out accounts in Active Directory setup.

Open CMD on your workstation and type

> dsquery computer -disabled

Command Line Output

Or

> search-adaccount -accountinactive -computersonly

Inactive Computers
Another method is to use the Visual Basic script.

' This code finds disabled computer accounts in an AD domain.

' ------ SCRIPT CONFIGURATION ------
strDomainDN = "" ' To find disabled computers in Active Directory replace with your actual domain name in LDAP format
' ------ END CONFIGURATION ---------

strBase = "<LDAP://" & strDomainDN & ">;"
strFilter = "(&(objectclass=computer)(userAccountControl:1.2.840.113556.1.4.803:=2))" ' Filter for disabled accounts
strAttrs = "name;userAccountControl" ' Retrieve name and account control attribute

Const ADS_UF_ACCOUNTDISABLE As Integer = &H2 ' Flag for disabled account

Set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADsDSOObject"
objConn.Open "Active Directory Provider"
Set objRS = objConn.Execute(strBase & strFilter & strAttrs & strScope)

objRS.MoveFirst
While Not objRS.EOF
If (objRS.Fields("userAccountControl").Value And ADS_UF_ACCOUNTDISABLE) = ADS_UF_ACCOUNTDISABLE Then
Wscript.Echo objRS.Fields(0).Value & " (Disabled)"
Else
Wscript.Echo objRS.Fields(0).Value & " (Enabled)"
End If
objRS.MoveNext
Wend

' Clean up
Set objRS = Nothing
Set objConn = Nothing

Implementing LDAP Queries

LDAP (Lightweight Directory Access Protocol) queries provide another way for finding disabled computers programmatically from the AD environment.

Using LDAP Browser Tools:

  • Step 1. Launch an LDAP browser tool like Apache Directory Studio, Softerra LDAP Browser, or JXplorer.
  • Step 2. Establish a connection to your Active Directory domain or server within the LDAP browser.
  • Step 3. Navigate to the query interface within the LDAP browser and input the constructed LDAP query.
  • Step 4. Run the query, and the results should display a list of disabled computers within the Active Directory.
# Import the Active Directory module

Import-Module ActiveDirectory

# Execute the LDAP query to find disabled computers

Get-ADComputer -LDAPFilter "(&(objectCategory=computer)(objectClass=computer)(!userAccountControl:1.2.840.113556.1.4.803:=2))"

Another traditional mechanism present inside AD is the Event Viewer so let us see how to use it and find all disabled and inactive computer objects.

Find Old and Defunct Computer Accounts in Active Directory via Event Viewer

  • Press Windows + R to launch the run module > Type “eventvwr.msc” and press Enter.
  • Once the event viewer opens, expand the Windows logs section and go to the Security tab.
  • After the Security subsection is available, take your cursor to the Actions pane and click on Create Custom View.
  • In the dialogue that appears, select the By log tab.
  • Choose the Security log and put 4725 in the Includes/Excludes Event IDs field.
  • Click OK and give your custom view a name.

Event Viewer
However, the Event Viewer is not a foolproof way to find inactive computers in Active Directory because of the following reasons.

  • Computer accounts are also treated as user accounts in the Active Directory. Meaning there is no way to filter out computer-only results from the list. Admins have to manually sort out the information that they require.
  • Moreover, in case a computer object was disabled just after its creation, or a computer was in an inactive state no users have logged into it, then it won’t appear in the event log at all. As it can’t show an event that has not happened yet.
  • Admins have to create a complex filter that combines. Computer creation event (4624), followed by removing all active computers (-4634). These multiple runs inside Event Viewer overcomplicate the task by a substantial amount.

Best Scriptless Way to Report & List Inactive Computer Accounts in Active Directory

Although PowerShell is available for listing inactive computer objects, administrators try to avoid using it for one reason or another. This does not mean that they want to put their IT infrastructure at risk; the opposite is true. They may not be confident in their ability to manage the scripts.

Worry not, if you wish to find disabled computers in Active Directory, you can trust the SysTools Active Directory Reporter. It combines the speed of the scripts with the ease of the GUI. All that in a single package. So get a copy and start with the steps given below.

Download Now Purchase Now

Step 1. Enter the tool’s dashboard by filling in the dummy credentials (administrator) in User ID and Password.

Type administrator and Start Finding Disabled Computers in Active Directory

Step 2. Make sure the tool is active, and then click the big blue button “REGISTER DOMAIN CONTROLLER” in the middle of your screen.

Register Domain Controller button

Step 3. Type the Domain Friendly name and IP Address, then press Save & Continue.

register domain controller

Step 4. On the Domain Details page, enter your Admin-level credentials and hit Save & Continue.

Save Credentials

Step 5. Go to the Reports Tab and pick the Disabled option under the Computers category.

Step 6. Once you are on the specific page, choose a predefined timeframe or set the Date boundaries yourself.

preset time intervals

Step 7. Then press the Preview button to get a glimpse of what your data would look like.

Preview and Find Disabled Computers in Active Directory

Step 8. Toggle the Download option and select CSV.

Download button

Step 9. Pick a folder path to keep the CSV report.

save CSV report

Step 10. Open and see what the disabled computer data looks like.

View CSV

Author’s Verdict

In this write-up, admins got a multi-method list on how to find disabled computers in Active Directory using PowerShell. Along with the tutorial, we helped clear up the difference between an inactive and a disabled computer. Moreover, for those who did not want a traditional approach, we gave an automated alternative too.

People Also Ask

Q. What’s the difference between a disabled and an inactive computer object?
Check out this table and see for yourself.

State Description
Inactive/Stale/Old Not used for a certain period
Disabled Blocked from logging on to the domain

A disabled computer is a predefined criterion that is built into AD. The definition of an inactive computer is set by the organisation itself.

Q. Why can’t I find disabled computers in Active Directory using PowerShell?
Although rare, this sort of situation is not new. A simple answer might be that the computer might not exist with the criteria you are trying to search for. Moreover, it may have been deleted.

Q. Are PowerShell scripts a safe way to track inactive computers inside the AD?
The safety of PowerShell scripts is a matter of attitude. Admins who are always alert face fewer problems than those who employ a casual approach. Moreover, if you want to minimise the risk, there is always the option of going with the professional-grade solution described above.

Q. Do disabled computers retain their data indefinitely?
Disabling a computer in Active Directory does not directly affect the data stored on the physical computer itself. It is just to prevent the computer from logging into the domain network.

The post Find Disabled Computers in Active Directory via PowerShell appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
How to Create an Organizational Unit in Active Directory? https://www.systoolsgroup.com/how-to/create-an-organizational-unit-in-active-directory/ Thu, 07 Aug 2025 12:03:55 +0000 https://www.systoolsgroup.com/how-to/?p=9371 Admins who are currently struggling as they dont know how to create an organizational unit in Active Directory can feel at ease. We have culminated multiple different strategies for OU

The post How to Create an Organizational Unit in Active Directory? appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Admins who are currently struggling as they dont know how to create an organizational unit in Active Directory can feel at ease. We have culminated multiple different strategies for OU creation in AD in this write-up.

Read and learn to use the native GUI portals or deploy code-based alternatives. However, before we get to know the methods, let’s understand why OU creation is done in an Active Directory.

Reasons to Create and Use Organizational Units in AD

There are primarily two reasons that push for the need for OU creation:

  • OUs allow administrators to delegate permissions at a granular level.
  • OUs help organize and manage resources (users, computers, groups) by department, location, or function.

Now that we know why OU creation is done, let us start with the most basic way first.

How to Create an Organizational Unit in Active Directory with ADUC?

  • Step 1. Open the Users and Computers Portal.
  • Step 2. Right-click on your Domain.
  • Step 3. In the context, menu, select New.
  • Step 4. Then tap on Organizational Unit.
  • Step 5. Inside the pop-up, add a Name and click OK.

You can get to the same position by going to the Action tab > New > Organizational unit. Or simply by clicking the New OU icon present in the ADUC toolbar. However, do so with caution, as it is not easy to move OU’s post creation.

create

Regarding the setting during OU creation in ADUC, there are not many things that the admin needs to configure. As there is only one other optional option along with the OU name. This is if admins want to protect the OU from accidental deletion. Choose the name carefully; otherwise, you will face many issues if you try to find the OU of the user at any time in the future.

By default, it is pre-selected, but you can unmark it; just remember, when you try to delete an OU with no protection, you won’t receive any warning.

Like the Users and computer portal, there is another GUI-based OU creation portal built in your Active Directory environment. So let’s see what it is and how to use it.

Make OU with the Help of the ADAC Portal

Some admins find it relatively simple, although there is no universal consensus. You can compare the two on your own with these steps for the Admin Center technique.

Launch the portal > Select your Domain > Expand New tab on the Right side pane > Select Organization Unit.

How to Create an Organizational Unit in Active Directory Using ADAC

The Window that appears has more configuration settings available that admins can set up at the time of OU creation itself. With the name being the only self-filled mandatory field. The rest of them are either decided in the background via the AD itself or can be safely ignored for the time being.

This is how to create an organizational unit in Active Directory via the ADAC portal. Some admins prefer this over ADUC as it allows for a more customized creation at the cost of an increase in setup time.

Those from a technical background can utilize code-based alternatives for faster bulk OU creation. You need not start from scratch, as we have laid out some basic scripts and queries to help you out.

PowerShell Script for Automated OU Creation

The following script creates a function that can be used repeatedly to create new OUs.

Open a new instance of PowerShell ISE and paste the following in the Script Pane (White Screen).

# Requires the Active Directory module
# Import if not already loaded
if (!(Get-Module -Name ActiveDirectory)) {
    Import-Module ActiveDirectory
}
function New-CustomOU {
    param(
        [Parameter(Mandatory=$true)]
        [string]$OUName,
        [Parameter(Mandatory=$false)]
        [string]$ParentPath = (Get-ADDomain).DistinguishedName,
        [Parameter(Mandatory=$false)]
        [string]$Description = ""
    )
    try {
        # Check if OU already exists
        $existingOU = Get-ADOrganizationalUnit -Filter "Name -eq '$OUName'" -SearchBase $ParentPath -SearchScope OneLevel -ErrorAction SilentlyContinue
        if ($existingOU) {
            Write-Warning "An OU with the name '$OUName' already exists at the specified location."
            return
        }
       
        # Create the new OU
        New-ADOrganizationalUnit -Name $OUName -Path $ParentPath -Description $Description -ProtectedFromAccidentalDeletion $true
        Write-Host "Successfully created OU: $OUName" -ForegroundColor Green
    }
    catch {
        Write-Error "Failed to create OU: $_"
    }
}
# Example usage:
# New-CustomOU -OUName "TestOU" -Description "Test Organizational Unit"
# New-CustomOU -OUName "HR" -ParentPath "OU=Departments,DC=contoso,DC=com" -Description "Human Resources Department"

Save and run the script.

Then, inside the Console Pane (Blue Screen) test out the script.

New-CustomOU -OUName "TestOU" -Description "Test Organizational Unit"

PowerShell to Create a New OU in AD

Sometimes admins may feel that PowerShell is too complex, especially when they have to use PowerShell to get a list of computers in an OU. Moreover, they might change something they weren’t supposed to. Not to worry, as apart from PowerShell, there is one more code-based method that is less intrusive on your AD.

How to Create an Organizational Unit in Active Directory on the Command Line

Press Win + R, Type cmd, click Enter, and paste:

dsadd ou "<Entire Path>"

Press Enter again to run the query.

For eg:

dsadd ou "OU=NewDepartment,DC=contoso,DC=com" -desc "New Department OU"

Use Command lIne to Create an Organizational Unit in Active Directory

Another classic command-line tool available for admins is the LDIFDE (LDAP Data Interchange Format Data Exchange). To use it and make new OUs, you have to.

First, make a plain text file that looks something like this.

dn: OU=Sales,DC=contoso,DC=com
changetype: add
objectClass: organizationalUnit

dn: OU=Marketing,DC=contoso,DC=com
changetype: add
objectClass: organizationalUnit

Then save the file with the .ldf extension and use the following command to call and run the script.

ldifde -i -f OUCreation.ldf

Apart from this, you can also use the VBScript (Visual Basic Script) or other programming languages like C# to programmatically make new OUs. However, they don’t offer any significant advantage over the methods that we have already discussed.

This completes all the methods that are available for OU Creation.

Best Practices to Follow During New OU Creation in AD

Make sure that the historical OU structure is intact and only build new ones without disturbing the original ones.

Keep a record of OU modifications to perform troubleshooting anytime in the future. Use the SysTools Active Directory Reporting solution to verify new OU creations remotely without much effort.

Download Now Purchase Now

Keep OUs under supervision by appointing pseudo-admin roles. So, once you figure out how to create an organizational unit in Active Directory, distribute responsibility from the super admin, and build a level of escalation systems in case things go wrong.

Follow the predefined naming conventions for new OUs to avoid confusion. Include business units or locations so that the role and function of the OU are readily apparent.

Don’t over-create OUs. It is important to keep the number of New Organizational Units at a manageable level to avoid confusion.

Ensure that the OU structure remains simple and consistent; if the OUs are too deeply nested, then they lose the sense of purpose and end up doing more harm in the long run.

Conclusion

So now admins have all the tools they need and know how to create an organizational unit in Active Directory without any issues. There are a lot of different ways through which one can complete the task, which include ADUC, ADAC, PowerShell, and the command line. Moreover, for tracking whether or not the OU creation was successful, admins can use the automated tool.

Frequently Asked Questions

Q. How to create an Organizational Unit in Active Directory in the least possible time?

Use a PowerShell Script. Although the initial setup time is more when compared to other methods. The amount of flexibility and customization you get beats all other methods in multi-OU setup scenarios.

Q. How many OUs can I have inside a single domain?

There is no magic number. You should make as many OUs as your organization needs. However, it is the IT administrator’s responsibility to figure out whether a new OU is needed or an existing one can hold the objects. The more OUs greater the complexity in management.

Q. Do I need to assign members at the time of OU creation?

No, you can keep the OU empty at the time of creation and fill in the members later.

The post How to Create an Organizational Unit in Active Directory? appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
How to Find Inactive Users from Active Directory and Export the List? https://www.systoolsgroup.com/how-to/export-inactive-users-from-active-directory/ Thu, 31 Jul 2025 13:02:49 +0000 https://www.systoolsgroup.com/how-to/?p=9307 Stale user accounts in Active Directory are more than just clutter; they pose a significant security risk if left ignored. We understand why IT administrators have a hard time answering

The post How to Find Inactive Users from Active Directory and Export the List? appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Stale user accounts in Active Directory are more than just clutter; they pose a significant security risk if left ignored. We understand why IT administrators have a hard time answering how to find inactive users in Active Directory. Unlike disabled computers, which have a different icon from regular computers, stale users show no such visual indication.

That is why I have prepared this guide that contains four distinct methods of identification. You can then use them to get a list of users who have not logged in for a while. So, let us stop dormant accounts from becoming a threat to your Active Directory environment together by identifying them through PowerShell, GUI, line, and more. First, we ensure that our environment is ready to run the cmdlets.

Prerequisites to Find Stale Users in Active Directory

First up, check that the latest compatible version of PowerShell is installed on your machine. PowerShell may need to be updated before you can use it to export a list of inactive AD users.

Once the PowerShell portal is up and running, add the necessary modules that allow you to search inside AD. more specifically the

You need to run PowerShell with sufficient permissions to query Active Directory, typically as a Domain Administrator or with delegated permissions.

  • Press the Windows Icon > Open Settings Menu.
  • Select System > Scroll till you see the Optional Features section in the left pane and click it.
  • Inside the Optional Features, click on Add a feature.
  • Use the Search bar in the pop-up to find the “RSAT: Active Directory Domain Services and Lightweight Directory Services Tools”
  • Mark the check box next to it, then click on the Add button at the bottom.
  • After some time, the utility would be ready for use.

These steps are for Windows 10/11 machines; if you operate a Windows Server, there might be a slight change, so you can use the Install-WindowsFeature RSAT-AD-PowerShell command instead.

Then, put  Import-Module ActiveDirectory

PowerShell Script(s) to Find Stale AD Users

The following script can help you get the list

 Search-ADAccount –AccountInactive –UsersOnly

If you want to search ad accounts that have been inactive for 90 days, put in that value instead

$d = [DateTime]::Today.AddDays(-180)
Get-ADUser -Filter '(PasswordLastSet -lt $d) -or (LastLogonTimestamp -lt $d)' -Properties PasswordLastSet,LastLogonTimestamp | ft Name,PasswordLastSet,@{N="LastLogonTimestamp";E={[datetime]::FromFileTime($_.LastLogonTimestamp)}}

If you find the code-based method to be too technical, then you might use additional options built into your Active Directory infrastructure.

Traditional Methods to List Inactive Users in Active Directory Using ADUC

There are a couple of areas you can look into to find those users who have not shown any signs of activity. First up I have the Users and Computers portal.

  • Step 1. Open up ADUC.
  • Step 2. Click on View to enable Advanced Features.
  • Step 3. Right-click on a user and select the Properties option in the Context menu.
  • Step 4. When the user properties portal opens, go to the attribute editor.
  • Step 5. Type l and look for lastLogon and lastLogonTimestamp to see if the user has been inactive or not.

Repeat for Every User you suspect of not being active on the AD. You can ignore the users whose icon has a little black downward-pointing arrow, as it means that those users are disabled or expired, so by default, they are inactive.

Suppose you don’t know how to find inactive users from Active Directory without making multiple repetitive searches. When there is a large number of users, you can use ADUC in another way. This is filtering out the inactive users.

  • Step 6. Click on the Filter.
  • Step 7. Mark creates a custom filter > Press Customize… > toggle Advanced > Paste.
  • (&(objectclass=user)(objectcategory=person)(userAccountControl:1.2.840.113556.1.4.803:=2)(whenchanged>=#LAST_DAYS#))
  • Step 8. Replace #LAST_DAYS# with the time interval.
  • Step 9. OK > OK.

This should hide all users who were active as well as other object types, so you can browse for the users and export the results via the built-in button on the toolbar.

Find All the Users Who Haven’t Logged in to AD Using the Command Line

There is a simple one-line query that does the job

dsquery user -inactive  <Number of Days> -limit 100

Replace the <Number of Days> part with your value and also increase or decrease the limit part.

The command line can be directly used to secure the AD. Admins can get rid of inactive accounts or put them in disabled status.

To Disable

dsquery user -inactive <Number of Days> | dsmod user –disabled yes

To Delete

dsquery user -inactive <Number of Days> | dsrm -noprompt

An easier script-free method that displays the list of non-active users is given below.

How to Find Inactive Users from Active Directory Professionally?

All the above methods can provide you with a list of inactive users, but they all have their limitations, as they require technical know-how, administrative privileges, etc. After all this, you can still face encounters while executing the same. To overcome all these complexities, I use the SysTools Active Directory Reporting tool, which can get you the list of all inactive AD users in just a few clicks. Not only can you use this tool, you can use the built-in Date picker that will help you see how many users have been inactive for 5, 7, 10, 30, 60, 90, to up to 1 year.

So you can export the most accurate list possible. Moreover, the custom option allows admins to set up a specific date range for inactivity tracking. So those who feel PowerShell to be confusing and the default AD options to be limited can make use of this software to remotely prepare the inactive user list inside the Active Directory

Download Now Purchase Now

The following steps will help you use the tool:

Step 1. Launch the tool and let the credentials autofill.

Type administrator

Step 2. Click on REGISTER DOMAIN CONTROLLER.

Register Domain Controller button to add the domain where you will find inactive users from active directory

Step 3. Type the Domain Friendly Name and IP, and Save.

browse-pdf-file

Step 4. In the Domain Details page, fill in admin credentials and save.

permission validation before you can answer how to find inactive users from active directory

Step 4. Go to the Reports section, click on the Inactive category under the Users Workload.

select the category you believe is the best answer to how to find inactive users from active directory

Step 5. On the next Screen, add the Date Picker and press Preview.

view date selection

Step 6. All inactive users in the Active Directory should appear on the Dashboard.

Preview

Step 7. Expand the Download Tab and Click on CSV.

successfull download message that helped you to answer how to find inactive users from active directory

Step 8. Then choose where you want to keep this report and view it in a text editor or spreadsheet program.

Conclusion

In this article, I have provided a thorough explanation of how to export inactive users from Active Directory. As we saw, there are multiple different ways to track inactive users, from ADUC, ADAC, Event Viewer, and PowerShell modules. Apart from the traditional way, I have shown you a modern approach to list out all users who have not been active for a while inside Active Directory.

Frequently Asked Questions

Q1. Is a Disabled user the same as an inactive user in Active Directory?
No, inactive users mean a particular user who can access the AD anytime but has not done so in a while. Whereas the disabled category is for those users who can no longer enter the AD unless the admin changes their account status. So, in a way, all disabled users can be put into the inactive category. However, the opposite is not true.

Q2. What is the threshold after which a user account is considered inactive?

Usually, admins start asking how to Find Inactive Users from Active Directory if a user stays stale for 90 days or more (roughly 3 months). However, it can be greater or lesser as per your organization’s policy.

Q3. What can I use if my AD does not have the Users and Computers portal? 

Other than ADUC, there is the Admin Center, which can be used for the same. Here, the process is quite similar, where admins have to launch the portal using the same LDAP query inside Global Search to bring out the inactive accounts. Select, copy, and paste the results into an external area like Notepad.

Q4. Can the Event Viewer tell me anything about the stale users?

Event Viewer can’t be used as it is designed to record live activity, so it can’t accurately measure user inactivity.

The post How to Find Inactive Users from Active Directory and Export the List? appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Remove SID History Post-Migration for Selected Users https://www.systoolsgroup.com/how-to/remove-sid-history-after-migration/ Thu, 31 Jul 2025 06:43:00 +0000 https://www.systoolsgroup.com/how-to/?p=10040 Admins in charge of an Active Directory transfer often have to remove SID history after migration completes. Many new admins are unaware of how important it is to clear out

The post Remove SID History Post-Migration for Selected Users appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Admins in charge of an Active Directory transfer often have to remove SID history after migration completes. Many new admins are unaware of how important it is to clear out legacy security identifiers from the new AD environment.

Table of Contents Hide

Moreover, deleting this immutable code is not as easy as it seems. That is why in this blog, we expose the risks of keeping old SIDs and also give multiple ways of safely removing the SID History parameter.

What is SID History? Why Admins Cleanup SID History After Migration?

Security Identifier history plays an important role in cross forest Active Directory migrations by establishing the trust relationship.
As soon as an object moves into the new environment, the target AD assigns its own SID attribute, so the old value shifts into a new parameter that keeps track of what resources an object had access to. Thus giving the much-needed backward compatibility.
However, post-migration, the same backlink can transform into a security risk and lead to other complications. Some of them are:

  • Unauthorized Resource Access: It is not always that the old AD may still be operational after migration. So outdated SID can cause agents from the source AD to gain entry into the new system, increasing the risk of data breaches.
  • Excess Token Bloat: Admins want to make their Active Directory infrastructure as efficient as possible. Old users who have been with AD for a long time often have multiple SID history values with them, especially if there was no proper cleanup crew. This can cause problems like Kerberos token bloat. So it is best to remove SID history for one user at a time or all at once.

    Also Read: What is Kerberos Authentication in Active Directory 

  • AD Compliance Requirements: Critical industries that make use of AD can’t afford to let their data leak, so they are often mandated by law to clear out all sources of information breaches, like SID History. This has the added benefit of making the environment easy to audit.

Now that we know all about SID history and reasons to remove it, let’s go over the manual options admins have at their disposal. If you’re looking for broader strategies for managing your Active Directory, including dealing with inactive users, you might find this guide on exporting inactive users from Active Directory helpful.

How Admins Can Remove SID History for One User or More via PowerShell?

But why are we using PowerShell? Isn’t there an easier way?

Reason is that SID history is not a parameter that standard AD tools like ADUC (Active Directory Users and Computers) or ADAC (Active Directory Administrative Center) can modify.

This is because SID History is a protected attribute owned by the Security Accounts Manager (SAM).

So, administrators must use alternative techniques, like PowerShell. Given below is a script that prints out a list of all user elements with SID history, performs a cleanup operation, then reprints the same user list for visual confirmation:

# Specify the OU where your migrated users reside.  CHANGE THIS TO YOUR OU PATH!
$MigratedUsersOU = "OU=MigratedUsers,DC=yourdomain,DC=com"

# --- Step 1: Find and View SIDHistory ---
Write-Host "--- Finding users with SIDHistory in OU: $MigratedUsersOU ---" -ForegroundColor Yellow
Get-ADUser -SearchBase $MigratedUsersOU -Filter {SIDHistory -like "*"} -Properties SIDHistory | Select-Object SamAccountName, SIDHistory

# --- Step 2: Remove SIDHistory (with error handling) ---
Write-Host "--- Removing SIDHistory from users in OU: $MigratedUsersOU ---" -ForegroundColor Yellow

# Get users with SIDHistory and remove it.
$usersWithSidHistory = Get-ADUser -SearchBase $MigratedUsersOU -Filter {SIDHistory -like "*"} -Properties SIDHistory

if ($usersWithSidHistory) {
  $usersWithSidHistory | ForEach-Object {
      $user = $_.SamAccountName
       $_.SIDHistory | ForEach-Object{
        try {
            Set-ADUser -Identity $User -Remove @{SIDHistory = $_.Value} -ErrorAction Stop
            Write-Host "SIDHistory removed from user: $User" -ForegroundColor Green
        }
        catch {
            Write-Host "ERROR: Failed to remove SIDHistory from user: $User" -ForegroundColor Red
            Write-Host "Error details: $($_.Exception.Message)" -ForegroundColor Red
        }
      }
  }
}
else {
  Write-Host "No users with SIDHistory found in the specified OU." -ForegroundColor Green
}

# --- Step 3: Verify SIDHistory Removal ---
Write-Host "--- Verifying SIDHistory Removal ---" -ForegroundColor Yellow
Get-ADUser -SearchBase $MigratedUsersOU -Filter {SIDHistory -like "*"} -Properties SIDHistory | Select-Object SamAccountName, SIDHistory

Write-Host "--- Script Complete ---" -ForegroundColor Cyan

PowerShell isn’t the only way you delete insecure SIDs from the Active Directory; there are other methods as well.

SID History Cleanup Using ADSI Edit

Caveats:

  • High Risk: One mistake can damage AD.
  • Not Scalable: Best for just a few objects.
  • Limited Auditing: Does not track SID History clean up automatically.
  • Replication: Allow time for changes to replicate.

Steps:

  1. Press Win + R, type adsiedit.msc, and press Enter.
  2. If prompted, select the Default Naming Context.
  3. Navigate to the correct OU/container and find the user/group.
  4. Right-click the object and select Properties.
  5. Go to the Attribute Editor tab and scroll to sIDHistory.
  6. Double-click the attribute. In the multi‑value editor, select the old SID(s) and click Remove.
  7. Click OK to apply changes. Admins may have to wait for replication in case of multi-domain environments.

Using LDIFDE (for Bulk Operations)

Make sure you have the necessary LDIF Knowledge, as incorrect syntax can cause errors.

Step 1. Open an elevated Command Prompt and run:

ldifde -f users_with_sidhistory.ldf -d "OU=MigratedUsers,DC=example,DC=com" -r "(&(objectClass=user)(sIDHistory=*))" -l "samaccountname,sIDHistory"

Step 2. Open the file in a text editor. For each object, ensure it follows:

dn: CN=SomeUser,OU=MigratedUsers,DC=example,DC=com
changetype: modify
delete: sIDHistory
sIDHistory: S-1-5-21-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxx

Step 3. Import the Modified File by running the import command:

ldifde -i -f users_modified.ldf -s MyDC.example.com -k -j .

Step 4. Use ADUC or ADAC to confirm that sIDHistory has been removed.

Optional Step. Wait for replication to fully propagate across a multi-domain environment (if you have one)

The manual methods described above are far too complicated and have a high chance of mistakes. If you’re undertaking a larger Active Directory migration, you might be interested in exploring alternatives to traditional tools like ADMT. This article on ADMT replacement and alternatives provides some valuable insights. Don’t worry, as we also give you access to a tool that does all the heavy lifting for you.

Best Way to Remove SID History for One User or More During AD Migrations

The latest version of SysTools Migrator for Active Directory brings in a new automated SID history detection and cleanup mechanism. After admins complete an AD migration – a process you can learn more about in this guide on migrating AD objects – they unlock a variety of post-migration options like report generation, GPO manipulation, and of course, SID History removal.

Download Now Purchase Now

The best part is that admins no longer have to worry about complex scripts, as the entire process is in a GUI. All admin has to do is click a few buttons, and their AD becomes free of insecure SID History.

Conclusion

Here, admins saw a variety of ways to remove SID history after migration, be it for one user or all the accounts in their new Active Directory that were brought from another domain. This is an important security measure and a sure-shot way to reduce token size as well. We gave instructions on how to approach this task manually via the console available inside every AD and PowerShell scripts as well. However, manual methods always carry an element of risk. So it is better to migrate with a tool that gives an automated SID cleanup feature.

Frequently Asked Questions

Q. How do I clear SID history in PowerShell?

SID History cleanup can be done via PowerShell scripts, GUI-based ADSI edit, or the LDIFDE command line query. If you use our tool to bring AD users from another domain, you can remove SID history right after the migration ends.

Q. How to check if SID History is enabled or not?

To view whether or not your domain uses the sIDHistory parameter, you can use the ADUC. From the View enable Advanced Features > Right click on the object > Properties > Attribute editor > scroll till you see the sIDHistory parameter. You can also use the netdom trust command.

Q. What does removing SIDHistory access denied mean?

It is a warning flag issued by Active Directory when it detects unauthorized changes being made in sensitive attributes like the SID history. This issue is most likely to occur if you use ADUC to clean up the SID History.

Q. How do I export SID history to CSV in PowerShell?

Open a PowerShell instance and type:

Get-ADUser  -Filter {SIDHistory -like "*"} -Properties SIDHistory | 
Select-Object SamAccountName, SIDHistory | 
Export-Csv -Path "C:\Temp\UsersWithSIDHistory.csv" -NoTypeInformation

The post Remove SID History Post-Migration for Selected Users appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Find Locked Out Accounts in Active Directory: Full Guide https://www.systoolsgroup.com/how-to/find-locked-out-accounts-in-active-directory/ Tue, 22 Jul 2025 11:30:38 +0000 https://www.systoolsgroup.com/how-to/?p=8723 During the regular AD audit, admins often get stuck on one problem. That is how to find locked-out accounts in an Active Directory environment. Knowing the time/count of users facing

The post Find Locked Out Accounts in Active Directory: Full Guide appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
During the regular AD audit, admins often get stuck on one problem. That is how to find locked-out accounts in an Active Directory environment. Knowing the time/count of users facing an entry denial can help the admin form a strategy for further investigation and redressal.

Table of Contents

Moreover, they might need to make a list for reporting purposes. However, getting that data is easier said than done, not to mention the extra time spent re-enabling the accounts. Not to worry, as in this write-up, we give clear-cut instructions on identifying all those who can’t access their AD account. Let’s start with the most straightforward method that involves the cmd interface.

Find Which User Account Keeps Getting Locked Out of Active Directory with Command Line Queries

Two of the native code formats are the command line and PowerShell, both of which are available at the admin level for checking user account access. Here is the command line query to check for locked accounts in AD.

net user /domain

This pulls out the list of all user accounts available on your domain.

Then, one by one, copy a user name and paste it in place of the variable part of the query given below, and check if the AD account is locked or not

net user <UserName> | findstr /i /c:"Account active"

check account lockout status using command line
It can show one of three outputs. You must troubleshoot account lockout issues accordingly:

  • Yes
  • No
  • Locked

If it shows locked, then you have the right account.

An alternative way is to use the dsquery; the code for that is as follows:

dsquery * domainroot -filter "(&(objectCategory=person)(objectClass=user)(lockoutTime>=1))" -limit 0 | dsget user -upn -samid -dn

Dsquery Command to see which Active Directory user accounts are locked out

This is going to provide admins with a list of all users with and without locked account status. You may change the scripts to add a particular time frame or only show all users.  As discussed previously, PowerShell can also be used in this scenario.

How to Find Locked Out Accounts in Active Directory with PowerShell

Use the following scripts. Beware, direct copy-pasting may not work as intended. If you have an AD module and RSAT, then jump directly to the PowerShell command (part 2). Otherwise, install and load it in the PowerShell module with the help of the commands below.

Part 1: Loading the PowerShell Module

Install-WindowsFeature RSAT-AD-PowerShell

Get-WindowsFeature -Name RSAT-AD-PowerShell

Part 2: Using the PowerShell Command

Search-ADAccount -LockedOut | FT Name, DistinguishedName, LockedOut

PowerShell Output of AD account lockout status

Despite the promise of fast results, admins rarely see this happening when they choose scripts. As admins have to spend time in understanding and changing them to better fit their requirements.

Most external scripts like this one only show raw results that can’t be used in a professional report. Moreover, using external scripts on the AD always raises a question mark. So let’s see how a native solution allows admins to reduce some of these points.

Look and View Inaccessible Accounts in Active Directory with ADUC

An easy scriptless way to check for locked users is available inside the Active Directory Users and Computers portal. Faster checking means faster troubleshooting for account lockout issues.

  • In ADUC, go to the Users Container.
  • Select the User from whom you received the locked-out complaint.
  • Open the Account Tab

Unlock the Locked User Status in ADUC

There, you see the Unlock Account option. If there is additional text, “Unlock Account. This account is currently locked out on this Active Directory Domain Controller. It means that the user can’t access the AD.

You can also do the following:

Click Filter icon > Create custom filter > Customize > toggle Advance > Paste (&(objectClass=user)(lockoutTime>=1)) > OK > OK
This will make it easier for you to find locked users in the domain, as every other object is hidden. You can export the results via the built-in button on the toolbar.

However, many users have complained that the LDAP filters give erroneous results. The “lockoutTime” flag resets to 0 only after a user successfully logs on. So admins might see expired lockouts under active status affecting the accuracy of detecting locked accounts.

Limitations of Relying Solely on ADUC for Troubleshooting AD Account Lockouts

  • Admins have to find their way through the often confusing and cumbersome ADUC interface. This takes up much time even for a trivial task like locked user identification.
  • Another danger that inexperienced admins may face is that they can end up with unwarranted changes. These include the user expiring or disabling the user from the AD
  • Moreover, if you do not have prior information on locked-out status, you may have to repeat the search for each and every user on the Active Directory.
  • Not to mention that ADUC has no provision to perform a mass export of the data. Admins have to fill in the spreadsheet manually.

For these reasons, a better method is required. We are here to provide you with exactly that.

Automated Solution to Find Locked Out Accounts in Active Directory

SysTools Active Directory Reporting Software is the choice for all information gathering in any AD. Whether you want to find what OU a user is in or check the OU and sub-OU of computer objects, the tool can do it all. With its easy-to-use UI, admins should have no problem finding which user can’t get into their account.

Download Now Purchase Now

Moreover, the tool provides a separate column to track when exactly this problem began. See the results right within the preview window and export the report in CSV format. The duration picker in the tool allows admins to split the data into the timeframe they want. So now let’s understand the working of this tool in a step-by-step manner.

Instructions on Using the Tool to Find Inaccessible Accounts in AD

Step 1. Open the tool and load the home screen by using the default credentials that the tool fills in on its own. You can change it later via the tool settings.

Type administrator to start the tool for listing locked AD user accounts

Step 2. Press the “REGISTER DOMAIN CONTROLLER” button, or click the small building icon on the top right corner.

Register Domain Controller button to add the AD containing locked users

Step 3. Type an appropriate Domain Friendly Name, and set the IP address of your AD. Press Save & Continue.

Fill the AD details

Step 4. In the Domain Details Page, put the Admin Email and Password in their respective boxes and press Save and Continue. Then go to the Report tab.

Validate AD admin Credentials

Step 5. From the category menu, select Locked under the Users Workload.

AD account lockout status Category Selection

Step 6. Choose a pre-defined duration from 5, 7, 10, 30, 90 days, or 1 year. Otherwise, make a custom time range of your own.

apply any one of preset time intervals

Step 7. Click the Preview icon to see what the data is going to look like.

Download CSV containing AD account lockout status

Step 8. Use the Download option and pick CSV to get the report. Save and View the data file.

What Admins Should Do When Locked-Out AD Accounts Are Found?

As there can be an overlap between locked and disabled users, we recommend that admins export disabled users from Active Directory first. Moreover, user account lockups can bring productivity to a halt. So getting user access back should be the top priority.

Admins should start by checking the user login history in Active Directory setup. This will allow them to see when the last time a user successfully entered the AD.

Then they must also tally the last password change in Active Directory with user entry issues. This can give them an insight into which password change caused this issue.

Multiple wrong password attempts are the primary reason for getting locked out. This happens when they do not receive the password update notification on time.

How to Troubleshoot Account Lockout Issues in Active Directory?

Once you have the list of which accounts are facing the lockout issue, the next step is to fix the problem. To do that, you can follow this miniature guide.

The old (undeleted passwords) may continue to persist. Check the credential manager and delete all those unwanted passwords.

Sometimes it’s not the user but some application that is keeping a record of the outdated password and trying to use it. Open the services and see if any of them have the “Log On As” the locked-out user behaviour. If so, immediately update the password.

Like the services section, there is also the Scheduled tasks that happen automatically. The user may have set them up with their old credentials, which results in a lockout. So deleted the old scheduled task and made a new one with the updated credentials.

Task schedules may also contain some hints as to what is causing the issue, so fixing it may be a viable solution.

Other than the main workstation, employees also use their mobiles and other personal devices to log in. So admins should also be ready to fix the lockout issues in those devices.

Conclusion

Admins now have more than enough knowledge on how to find locked-out accounts in Active Directory setup. The information here helps in the identification of accounts as well as the reasons behind entry denial issues in any AD. Although PowerShell, CMD, and other native Active Directory methods exist, none can compare with the speed and accuracy of the tool presented.

Frequently Asked Questions About the AD User Account Lockout Situation

Can I use the Get-ADUser command to see the locked accounts?
Yes, the following command shows the same result:

Get-ADUser -Filter * -Properties LockedOut | Where-Object {$_.LockedOut -eq $true} | ft DistinguishedName, Enabled, LockedOut, Name

Here we look directly into the user-level objects so which gives faster results. However, the speed improvement is marginal and admins will only notice it during a mass lockout event.

I have a complicated folder hierarchy for user accounts; checking each sub-folder individually is too time-consuming. Is there any option to reduce the search duration?
If you need to know the exact location of the locked account, use Active Directory Administrative Center.
Open ADAC > Click on Global Filter > Toggle LDAP
Paste

(&(objectCategory=person)(objectClass=user)(lockoutTime>=1))

and Press OK.

You should see the results pop up in the bottom half of your screen.

You can apply the same LDAP query inside the custom filter settings of ADUC and hide all objects except the locked users.
Check Locked User Accounts Via ADAC

Which Event ID indicates a user lockout from the AD?
The Event ID concerning user lockout is 4740. To view it,

Open the Event Viewer application on the workstation > Windows > Security.

Use the find option to search for the relevant Event ID. Here you can check out additional details such as the time at which the lockout occurred, which is not possible with PowerShell or other native GUI mechanisms. However, the catch is that the result remains in a view-only state, and admins can only view one user at a time.

Event Viewer Data containing AD User Lockout information

Why are user accounts locked out of Active Directory?
The main reason behind every inaccessible account is the wrong password entry. This can have several subparts, like:

The post Find Locked Out Accounts in Active Directory: Full Guide appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Restore a Deleted Active Directory User Account: A-Z Steps https://www.systoolsgroup.com/how-to/restore-deleted-active-directory-user-account/ Mon, 21 Jul 2025 09:45:03 +0000 https://www.systoolsgroup.com/how-to/?p=10495 User management is one of the core aspects of any Active Directory setup. Moreover, it is during these user management requests that admins ask how to restore a deleted Active

The post Restore a Deleted Active Directory User Account: A-Z Steps appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
User management is one of the core aspects of any Active Directory setup. Moreover, it is during these user management requests that admins ask how to restore a deleted Active Directory user account.

Table of Contents Hide

The process is not as simple as it sounds. Depending on how your AD is set up, the restoration process may vary quite a lot. Don’t worry, as here we have assembled a bunch of methods that cover all possible scenarios. Plus, we also introduce you to a tool that can automatically detect AD objects in your environment, which you can use to see the restored users.

Let us start by discussing the reasons for restoration.

Why Admins Restore Deleted Active Directory Users?

Here is a list of situations that call for a user restoration process.

Undoing Accidental Deletion. This is perhaps the most common cause. When there are users with similar names, it is possible that admins might delete the wrong one. In such a scenario admin may find empty groups in Active Directory.

Reversing a malicious deletion. Disgruntled employees/ external hackers, or wrongly deployed scripts, may cause the user account to be deleted. There, too, admins have to do a restoration.

Return of an employee from a long leave or rehiring an old employee. Moreover, when an employee stays inactive for a significant amount of time, like during a sabbatical, admins usually put the account in a deleted state to prevent accidental misuse. When that employee returns to admission have to restore the account.

These are just some of the real-life situations where admins have to restore users. Before we begin the restoration process, it is important to understand the lifecycle of a deleted AD Object, as it is impossible to restore an object after a point.

Explaining the Lifecycle of a Deleted Active Directory Object

The cycle is different in environments where admins enable the Active Directory Recycle Bin than in those where they don’t. Let’s see what the difference is via a diagram.

Lifecycle of a Deleted Active Directory Object

 

By default, all objects exist in a Live state. When you delete those objects, they switch to the Deleted state. It is possible to restore all user objects that are in this state without any loss of data.

Now, if the IsDeleted flag is changed to True, then the object is permanently removed from the AD. After this, the object is said to be physically erased from the server.

Lifecycle of a Deleted Active Directory Object with Recycle Bin

In an AD where the Recycle Bin is being used, a second Recycled state is added to the lifecycle. This extends the period you have to restore an AD object like a user. Now that we know the object behavior, let us restore.

How to Restore a Deleted Active Directory User Account Using ADAC?

To attempt the following procedure, you must

Step 1. Launch ADAC, find and select the Deleted Objects container (It is usually present below your domain)

Step 2. If you have more than one deleted user, you will see a list. You can select a contiguous list of users by holding the shift key or a non-contiguous list by holding the Ctrl key and using your cursor to pick the users.

Step 3. Then Right-click and select Restore. Every user will be put back into the OU/Container they were assigned to before their deletion.
Other than the “Restore” option, there is also a “Restore to” option, which lets you decide where in the AD you want these user objects to exist.

How to Restore a Deleted User Account in AD Using PowerShell Cmdlets?

Given below is a sample PowerShell cmdlet that will restore the user accounts in those Active Directory environments that use the Recycle Bin facility.

Open a new PowerShell instance to view the list of users that are deleted. Type:

Get-ADObject -Filter 'isDeleted -eq $true' -IncludeDeletedObjects -Property * | Format-List Name, ObjectGUID, Deleted, DistinguishedName

You can modify the cmdlet to format the list with your own set of parameters. Just keep the “Get-ADObject -Filter ‘isDeleted -eq $true’ -IncludeDeletedObjects” part unchanged.

After this, copy the ObjectGUID or the Distinguished Name for the user you want to restore and type:

Restore-ADObject -Identity

This works similarly to the Restore button in the ADAC. Both of the methods we discussed until now require you to have the Recycle Bin. However, what to do if you dont? Enabling it now won’t be of any use. If you are in a similar situation, go through these steps.

How to Restore a Deleted Active Directory User using LDP.exe Step by Step?

LDP.exe is the GUI version of the Lightweight Directory Access Protocol. To use it, follow these steps:

Step 1. Press the Windows + R keys together and type ldp.exe. Press Enter.

Step 2. This will launch a new LDP window on the Connection menu. Click Connect. Type in your domain controller name and hit OK.

Step 3. Then, go back to the Connection menu and click Bind. There, select Bind as currently logged-on user and click OK.

Step 4. Under Options >> Controls >> expand the Load Predefined dropdown and select Return deleted objects. Press OK to confirm. You can now see the User objects that are in the AD tombstone.

Step 5. Now in the View menu, click on Tree, select your domain from the BaseDN dropdown, and hit OK.

Step 6. Then, a tree pane opens on the left side of your screen, where you expand your domain >> You should see a CN=Deleted Objects container. Double-click it.

Step 7. Find the user you wish to restore. Right-click >> Modify. Add these two parameters from the Modify dialog to your list:

  • Attribute: Type isDeleted.
  • Operation: Select the Delete radio button.
  • Click Enter
  • Attribute: Type distinguishedName.
  • Values: Enter the original, full, distinguished name of the user.
  • Operation: Select the Replace radio button.
  • Click Enter

Step 8. Make sure that the two operations are in the list, mark the Extended box at the bottom, and hit Run.

Step 9. This process will restore the User, but it will be in the disabled state. So, export disabled users from Active Directory. Plus, you must manually reattach to all the groups it was in before being deleted.

Apart from These Usual tactics that work at the object level, we also have a domain-wide restoration called Authoritative Restore. So let’s see what it is and how it can be used to get back any deleted AD users.

Perform an Authoritative Restore in Active Directory to Recover User Accounts

Unlike previous methods, you can’t start an authoritative restore out of the blue. As an admin, you must first ensure that the following conditions are met.

Pre-requisites:

  • First, there should exist a healthy system state backup of the DC that was made at the time when the user was still in the AD.
  • Second, you should possess knowledge of the user object’s distinguished name that was being used before it was deleted.

Steps:

Step 1. Restart the AD, and while it’s restarting, press F8 to toggle the “Directory Services Restore Mode (DSRM)”; you will be prompted to use your DSRM administrator account and password. This is different from the regular AD login password.

Step 2. Then, launch the Command Prompt(in admin mode) and use ntdsutil to mark the user object as authoritative. And Type:

ntdsutil
activate instance ntds
authoritative restore
restore object "CN=User Name, OU=Department, DC=yourdomain, DC=com"

Step 3. Click Yes to confirm. Then, type quit twice to exit the ntdsutil tool, and then reboot the domain controller back into normal mode.
The user will now be restored and replicated to other DCs.

Best Practices to Follow While Restoring a Deleted Active Directory User Account

Download Now Purchase Now

  • Use the restoration method applicable for your Active Directory environment.
  • Start using the Recycle bin in your AD.
  • Document the process for future reference.

Conclusion

Here we saw how to restore a deleted Active Directory user account in many different ways. We discussed what to do in environments where there is a Recycle bin and what to do if you dont use it. We taught you everything from PowerShell and admin center restoration to using LDP and even performing an authoritative restoration. Moreover, you can use our automated utility that will help you distinguish between the pre- and post-restoration status of user objects in AD.

The post Restore a Deleted Active Directory User Account: A-Z Steps appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Rename AD Group and Change Active Directory Names https://www.systoolsgroup.com/how-to/rename-ad-group/ Mon, 29 Jul 2024 13:17:06 +0000 https://www.systoolsgroup.com/how-to/?p=9427 Any admin who wants to rename the AD group may think a lot about where to start. Groups govern many important aspects of an Active Directory, such as policy assignment.

The post Rename AD Group and Change Active Directory Names appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Any admin who wants to rename the AD group may think a lot about where to start. Groups govern many important aspects of an Active Directory, such as policy assignment. Moreover, they can act as a miniature organizational unit, so a Group name change is quite a significant event.

So we have made a thorough list of methods that can be used to update the group name in the Active Directory. Use the one that suits you best, but before that, take a look at the possible reasons for the change.

Why Change the Group Name in the Active Directory?

Reasons why groups may be renamed are as follows:

  • The group name is incorrect or misspelled.
  • You found empty groups in AD and want to rename them for easier filtration.
  • The original intent of the Group name is no longer valid.
  • After generating an AD Group membership report, and the policy it is designed to work with does not match its name, e.g., marketing team members are placed under the HR group.
  • Renaming a group also boosts AD security as it helps admins whenever they want to export inactive users from the Active Directory environment.

In such scenarios, if the number of underlying elements is large, then instead of commissioning a large internal migration, admins can simply rename the group to match its new intent.

Note: The change in group name does not affect the policy prescribed to it. As resource access and policy are governed by SID, which is an immutable variable.

Rename AD Group Using the Users and Computers Portal

  • Step 1. Select the Group to highlight it.
  • Step 2. Wait for a second and then click again. It makes the name editable.
  • Step 3. Press backspace/delete to clear the existing name.
  • Step 4. Type in the new name and press enter (or click on any blank space on the ADUC portal).
  • Step 5. A Rename Group pop-up will appear. Verify the new name you are about to put in.
  • Step 6. You can also change the pre-Windows 2000 name.
  • Step 7. Once done, press OK.

A second method from within the ADUC is also available:

  • Step 1. Open the View tab and enable the Advanced Features option.
  • Step 2. Then double-click a group.
  • Step 3. This will open the Group Properties window.
  • Step 4. Go to the Attribute Editor tab.
  • Step 5. There you will find the list of all attributes. Select the naming attributes you wish to update.
  • Step 6. Type in new values, hit Apply, and OK.

Group Name Change in the Active Directory from the Admin Center

Admin center is applicable in other use cases, other than finding what OU a user is in.

  • Step 1. Open ADAC
  • Step 2. Toggle the Global Search
  • Step 3. Change the search settings to LDAP and paste this:
(&(objectClass=group))
  • Step 4. Press Apply

Select any group and open Properties; from there, you can rename the group easily.

Use PowerShell to Rename an AD Group

You can use the Set-ADGroup cmdlet to modify attributes like sAMAccountName, displayName, or description. For renaming the group, use Rename-ADObject.

Set-ADGroup -Identity "GroupName" -sAMAccountName "NewSAMAccountName" -DisplayName "New Display Name" -Description "Updated Description"

Rename AD group (change cn):

Rename-ADObject -Identity "CN=OldGroupName,OU=Groups,DC=yourdomain,DC=com" -NewName "NewGroupName"

Explanation:
Set-ADGroup -Identity: Modify group attributes like sAMAccountName, displayName, and description.
Rename-ADObject: Renames the group (cn) while keeping the distinguished name (DN) intact.

Changing Group Attributes via Command Line (CMD)

If you dont want to use PowerShell for renaming an Active Directory Group, you use the command-line queries. More specifically, you can use dsmod to modify the sAMAccountName and description. Unfortunately, dsmod cannot change the CN directly (so you must rename the CN of AD groups through PowerShell).

dsmod group "CN=GroupName,OU=Groups,DC=yourdomain,DC=com" -samid NewSAMAccountName -desc "New Description" -display "New Display Name"

Explanation:
dsmod group: Modifies the group’s attributes, including sAMAccountName, description, and displayName.

Admins can set a sandbox group and limit resource access via GCP.

A bulk renaming is not recommended, as you may end up changing something that wasn’t required.

Best Practices While Renaming Groups in AD

There is not much to take into consideration, except that admins require external verification to ensure that the name change was successful. So, for that, look no further than SysTools AD Reporting Tool, the ultimate solution for administrators.
Key Benefits:

  • Easily view and extract the number of groups in your AD
  • No complex scripts required
  • Customizable reporting to meet your organization’s needs
  • Access to group creation date, Distribution, and Security groups

Try it Today!

Download Now Purchase Now

Flexible Reporting Options allow you to categorize reports based on your organization’s requirements.

Conclusion

This post gave users plenty of ways to rename AD groups easily. So now the administrators do not have to worry about changing the name of a group in the Active Directory or shifting all elements to a new group. The admins can use PowerShell to rename AD or the command line to adjust the samaccountname. For GUI methods, we have the Active Directory Users and Computers portal and the administrative center. Moreover, any changes that admins make can be verified with the help of an automated reporting tool, as outlined in the best practices.

Frequently Asked Questions When Admins Change the Name of an AD Group

Q. Is there a cool-down period between two successive Active Directory group name change attempts?

AD has no limits on how often you can change an object name. Admins may be able to put in some restrictions via group policy, but that’s it.

Q. What is the maximum number of times I can rename the Active Directory group?

There is no limit, but multiple name change operations in a short period can cause your AD to malfunction. The biggest problem is that if you operate a multi-domain structure, the new name update must reach every AD; too many requests can overwhelm the replication bridge.

Another problem stems from a user’s point of view. If the AD name change is abrupt and has a high frequency without prior warning, you may see internal IT complaints rise from users looking for answers.

Q. Can I keep an AD group name empty?

You cannot have a blank name. AD will automatically remove any leading/trailing spaces.

Q. Why don’t I see the complete Active Directory group name after renaming?

You can have spaces between two words; just note that if you put more than one space, the name will appear in a truncated format.
So you will only see the first character followed by 3 dots(…).

Q. What characters are allowed in an Active Directory Group name?

Every special character present in the (default US keyboard) can be put in the name. However, the pre-2000 name column won’t allow any special characters other than the underscore. You can change the pre-2000 name, remove it entirely, or replace the special character with the underscore ( _ ).

Q. Is there a size limit on the AD group name?

Yes, the number of characters in the name cannot exceed 64. This limit is on the count itself and applies regardless of size. Therefore, you can have no more than 64 characters, whether it is a wide capital “W” or a thin small “i“.

The post Rename AD Group and Change Active Directory Names appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Check When Password Expires in Active Directory & Get All Dates https://www.systoolsgroup.com/how-to/active-directory-check-user-password-expiration-date/ Mon, 22 Jul 2024 13:37:05 +0000 https://www.systoolsgroup.com/how-to/?p=8707 Admins who don’t know how to check when password expires in Active Directory may need our help. A lack of transparency in AD password management may result in users being

The post Check When Password Expires in Active Directory & Get All Dates appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>
Admins who don’t know how to check when password expires in Active Directory may need our help. A lack of transparency in AD password management may result in users being locked out of their accounts. So it’s better to have a list that admins can refer to and send reminders to users whose access is about to end.

Table of Contents

Here in this write-up, we provide you not one or two but three separate methods for the same. But before we see what the methods are, let’s check the reasons for finding the password expiration date.

Why Admins Look For Password Expiration Date in AD

Like the reasons to check the last password change in AD a password expiry inquiry is also done with security in mind. Organizations that make their users change login credentials have a stronger security framework. Moreover, if passwords ever get leaked, triggering an expiry request can prevent backdoor access.

Compliance requirements are not new for admins who look after an AD. To make sure their organization is following what’s required admins may set up a password expiry policy. If a change in personnel occurs the new admin must quickly check what the date set by the previous admin was.

Knowing which users are locked out and not manually disabled is key to exporting disabled users from Active Directory as well.

All of this can only be done if administrators have access to a list.  So let us start by looking at the most requested PowerShell methods for identifying password expiration dates.

Now, let’s dive into the hidden command line method for identifying password expiration date

Easiest Way to Get Active Directory Password Expiration Date

Open a command line(cmd) instance and type:

net user %username% /domain | findstr /C:"Password expires"

active directory password expiration date command line

Breakdown of the command

Here “%username%” is a placeholder for the currently logged-in account.

The “/domain” part is to move the scope on the AD instead of the local machine.

The “findstr” and corresponding filter limit the output to and only display the “Password expires” data.

One out of two outputs may occur: either you get a date or a text that says “Never”.

This sort of result may be enough for a quick glance. However, for reporting purposes, admins need something more sophisticated.

Although admins and other privileged users can replace the placeholder with any other username and check their password expiry date as well this is time-consuming and defeats the purpose of the task. So that’s why admins move towards PowerShell which has more tools to display the results in bulk.

Get the Default AD Password Expiry Date with A PowerShell cmdlet

Experienced AD admins might already know this, but for those who are new to Active Directory user management, this serves as a starting point.

By default, every AD sets the password expiry date to 42 days after the last change.

Therefore, if the “password never expires” checkbox is not marked during user creation and no custom updates are made to the Password Policy then you may use the following cmdlet. It will add 42 days to the last password update and display when it expires.

Get-ADUser -Filter * -Properties DisplayName, pwdLastSet | Select-Object DisplayName, @{Name="pwdLastSet";Expression={[datetime]::FromFileTime($_.pwdLastSet)}}, @{Name="PasswordExpires";Expression={[datetime]::FromFileTime($_.pwdLastSet).AddDays(42)}} | Format-Table -AutoSize
  • Default PowerShell

However, there are a few problems with this approach.
First, it does not check for the “Password Never Expires” so some users get a date from the 15th Century. The AD by Default stores the Password Never Expired date as 12/31/1600.

Same problem exists for new users whose password is set by the admin and is scheduled for a change whenever the next user login occurs.

In this scenario, the AD fetches a password expiry date that has already passed. However, users will still be able to login with their default credentials. Although at that very moment the existing password expires and the user has to set a new one.

As the user can log in anytime to reset the password predicting a date is not possible. To bypass this we use an attribute called “msDS-MaximumPasswordAge”

How to Check When Password Expires in Active Directory Via Advanced PowerShell Scripts

Use the following scripts on a Windows PowerShell module to get a list of all users having an expiration date.

Note: This first cmdlet only shows the date of all users whose password is about to expire:

Get-ADUser -Filter {Enabled -eq $true -and PasswordNeverExpires -eq $false} –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |

Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

verified

We also have a “.ps1” script for you to highlight the users whose passwords may expire. It also tells you the users whose password will remain as it is.

Script to classify users based on their password expiry.

Get-ADUser -Filter * -Properties msDS-UserPasswordExpiryTimeComputed | Select-Object Name, @{Name="PasswordExpiry";Expression={[System.DateTime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed").ToString("yyyy-MM-dd HH:mm:ss")}}

Password Expiry Date Via PowerShell

Those who are not comfortable with PowerShell can use the command line queries as directed.

Fetch Active Directory Password Expiration Date with Command Line

See the entire user password expiry list

dsquery user -limit 0 | dsget user -display -samid -acctexpires -disabled

entire user password expiry list

Even these cmd-level codes are too tricky, not to mention risky. So to avoid the scripts entirely, you may choose the Active Directory Users and Computers snap-in.

Use ADUC and See If User Passwords Expires or Not

  • Search for Active Directory Users and Computers and open it.
    Search for ADUC
  • Click on the View option from the Dropdown mark Advanced Features.
    Advanced Features
  • Double-click on the Users container.
    Users container
  • Right-click on the user whose password data you want to view and hit Properties.
    Properties
  • In the properties window, go to Attribute Editor.
    Attribute Editor
  • Type “user”, it should highlight the userAccountControl attribute.
    user Account flag

However, the problem is that you can only view a flag and the text value associated with it. The flag you need to watch out for is 10000 [DONT_EXPIRE_PASSWD].

If you double-click, it opens a popup from where you can copy the data. However, keep in mind that you get an integer value and not the actual date. Moreover, the value you get is of no practical use.

If you see no such flag, then it means the user password may expire sometime in the future date to view the data we have to use the Admin Center.

Use the ADAC and See How many Days an AD User Password Stays Valid For

  • Open Active Directory Admin Center via the Server Manager or Windows search bar.
    Go to the Users Tab
  • Select a User
  • Click on the View Resultant Password Settings option from the rightmost pane.
  • A new box opens there look for the Enforce Maximum Password age option.
    View Password Reset

There lies the Active Directory Password expiration date that you are looking for. Note that the reason for not being able to view the password expiry date may be because of the following:

  • No password setting policy exists in the Active directory.
  • If set, the Password Setting policy is not applied to this user.
    User Password Policy Not Set

Professional Way to Check Password Expiry Date in Active Directory

For that use the SysTools AD Reporting Software. This tool trims down the manual effort required by admins. It does so by replacing the problematic scripts and commands with an entirely GUI-based setup. With little to no training, any admin will be able to pull their AD’s user password expiry data and present it in a readable format.

Download Now Purchase Now

The tool has its own Preview window and multidomain addition feature. So admins who are responsible for more than one domain can just add the AD domains and start listing out all the information that’s required.

With the help of a dashboard date filter, you can slice the decades-long data into more manageable chunks.

You might be wondering how this tool packs so much in a single package. For that follow the steps below and find out how its intuitive interface works.

Automated Steps to See User Password Expiry Parameter in AD

  • Open the tool on your machine and log in with the (administrator) credentials appear on the screen.
    Type administrator
  • Push the “Register Domain Controller”  button with your cursor to add your domain IP.
    Register Domain Controller button
  • Put the custom “Domain Friendly Name” and the correct “IP address” in the spaces provided inside the pop-up window. Then Tap the Save & Continue Button.
    Register Domain Controller screen
  • On the Domain Details page fill in your admin credentials, and Validate them with the help of the Save and Continue button.
    permission validation
  • Toggle the Report Tab and select the Password Never Expired category inside Users.
    toggle report tab
  • Click on the Duration option to set a premade date range or use the Custom option to make your timeline.
    view date selection
  • Click on the Preview button to check password expiration in Active Directory.
    Preview
  • To get Active Directory Password Expiration Date in CSV format press the Download button and Choose CSV from the dropdown.
    Download button

Conclusion

In this tutorial, readers learned how to check when password expires in Active Directory via PowerShell and other means. As the PowerShell Scripts and its sister command line methods are complicated, we gave the use case for ADUC. However, that too has its problems. Therefore, as a sure shot measure, admins can use the utility pitched earlier. With it, any reporting task, like the one to find user password expiry can be done without much effort.

Frequently Asked Questions After Viewing AD User Password Expiry Date

Q. How can I Set Up a New Password Policy Via the Admin Center?

  • Expand the arrow next to the domain name.
  • Click on System.
  • Choose Password Settings Container.
  • Click on New > Password Settings.
    Set User Password Policy
  • Fill in all the required details then go to the Directly Applies tab and put all the users you want.

Q. Is there a way to see the password expiry date via Event Viewer?
A. No, the Event Viewer does not generate any Event ID for password expiry. Moreover, trying to guess a date based on a failed logon event is difficult and error-prone.

Q. From where an admin can deploy a domain-wide password expiry policy?
A. It can be done via the group policy edit portal. Follow these steps.

  • Press Windows + R and type “gpme.msc” in the run module.
  • In the Browse for a Group Policy Object window choose a Group Policy.
  • Inside the Group Policy Management Editor Screen follow this path
  • Computer Configuration > Policies > Windows Settings > Security Settings > Account Policies > Password Policy
  • The Password Policy Attributes appear on the Right Pane. Select the Maximum password age option and check the details present in the window.
    GPME Steps

The post Check When Password Expires in Active Directory & Get All Dates appeared first on A Complete How to Guide - Get Solution to Your Queries.

]]>