-1

How to Disable in bulk AD user account using excel for selected employees

user113784
  • 53
  • 1
  • 3
  • 7

2 Answers2

5

Using Powershell, assuming a list of usernames in a text file - one per line:

get-content d:\data\users.txt |get-aduser |set-aduser -enabled $false
uSlackr
  • 6,412
  • 21
  • 37
1

If your Excel file contains the full LDAP path of the users, then use dsmod.

dsmod user "CN=John Doe,CN=Users,DC=microsoft,DC=com" -disabled yes

If you only have the SAM account name, then you can do a dsquery on that list and pipe that to dsmod.

In any case, you'd probably do better to work from plain text files and use BAT or PowerShell, rather than trying to parse XLS(X) files. Plain text is the scripter's friend.

mfinni
  • 36,144
  • 4
  • 53
  • 86
  • using text format what will be cmd to disable selected user with same job title – user113784 Mar 28 '12 at 13:21
  • It seems like perhaps you're not willing to explore the tools at your disposal? Look at the documentation in dsquery user /? and dsmod user /? - and then ask questions if you get stuck. – mfinni Mar 28 '12 at 13:44