Hi there,
You can first use a script to collect all users that are inactive for the said period and then export it to a text file and deactivate all the users as per the text file.
If you saved the text file to a different location than c:\it\users.txt you will need to update the script.
$users=Get-Content c:\it\users.txt
ForEach ($user in $users)
{
Disable-ADAccount -Identity $user
write-host "user $($user) has been disabled"
}
Run the command below to return only the username of disabled accounts and you can verify it with the text file.
Get-ADUser -Filter {Enabled -eq $false} | FT samAccountName
--If the reply is helpful, please Upvote and Accept it as an answer–