Hi,
I am using the script below to read the names of users from a .csv file and disable users from AD.
The script works alright but most of the time it take 5 minutes or even more to take effect and disable the users.
Is this normal or there is a better way to run the script ?
I am running the script from PowerShell ISE on my laptop that is login to the domain.
Thanks
Pankaj
Import-Module ActiveDirectory
$userlist=Import-CSV C:\ADUSERS\DisableUsers.csv
ForEach ($user in $userlist)
{
Disable-ADAccount -Identity $($user.name)
write-host "user $($user.name) has been disabled"
}