Sunday, October 21, 2012

Check account Disable from List

Hi Readers,

Just sharing a small script which I have made immediately for some work that has came just now.

Thanks to quest management shell.

Copy the script to a folder &  create a notepad in same folder(useraccounts.csv)

UserName
domain\user1
domain\user2
domain\user3

Execute the script :-  .\script.ps1   .\useracconts.csv

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

# import csv file

$data = import-csv $args[0]


#Check if user disabled

foreach ($i in $data)

{
$user=get-qaduser $i.username

if ($user.AccountIsDisabled -notlike “True”)

{

write-host “$user account is not disabled”

}

}

 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Regards

Sukhija Vikas

No comments:

Post a Comment