ps

Active Directory Powershell with CSV cmdlets to manage a bulk of objects

Import a lot of users into Active Directory can be a hard job if you do this one by one, but with Import-CSV cmdlet, this task could be easier. In this post we show how do this to select, create, change and delete users or another objects (computers/groups). We use cmdlets to manage users, but the same idea can be used for infinite things that an administrator need to do everyday.

Selecting users

Using a list of users in a column with header “USER”, we can search for each user in the CSV file. $_.SOMETHING is to represent the value for the column called “SOMETHING” in the current row.


Creating users

This command will create users, set password, a lot of other fields and enable each user.


Changing users

Users identified by samAccountName in the field “USERAD” will be changed with defined fields. You can see all fields available in this URL: https://technet.microsoft.com/en-us/library/ee617215.aspx

Deleting users

Users identified by samAccountName in the field “USERAD” will be deleted. For more about Remove-ADUser, you can see this URL: https://technet.microsoft.com/en-us/library/ee617206.aspx

Deixe uma resposta

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *