# How to automate creating AD users with PowerShell and Excel

**URL:** <https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748>\
**Category:** PowerShell Help\
**Created:** [December 5, 2018, 7:46am UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748 "2018-12-05T07:46:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannyps](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dannyps](https://forums.powershell.org/u/dannyps)\
**Post date:** [December 5, 2018, 7:46am UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748/1 "2018-12-05T07:46:49Z")

</div>

Generally I create new users by copying a Template user I created in AD and adding it to the correct OU, but I want to know how to automate new users with excel or basic PowerShell script that will copy the Template User from AD

How can this be done

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [December 5, 2018, 7:51am UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748/2 "2018-12-05T07:51:22Z")

</div>

There are literally thousands of examples for such a task out there in the internet. Some good points to start searching are:

[https://www.powershellgallery.com/](https://www.powershellgallery.com/)

and

[https://gallery.technet.microsoft.com/scriptcenter/](https://gallery.technet.microsoft.com/scriptcenter/)

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [December 5, 2018, 7:52am UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748/3 "2018-12-05T07:52:04Z")

</div>

Here is an article for you to start with.

> **[PowerShell: Bulk create AD Users from CSV file - TechNet Articles - United...](https://social.technet.microsoft.com/wiki/contents/articles/24541.powershell-bulk-create-ad-users-from-csv-file.aspx)**
>
> Technical articles, content and resources for IT Professionals working in Microsoft technologies

---

<div class="post-metadata">

**Author:** ![david-schmidtberger](https://avatars.discourse-cdn.com/v4/letter/d/ba9def/32.png) [@david-schmidtberger](https://forums.powershell.org/u/david-schmidtberger)\
**Post date:** [December 5, 2018, 7:52am UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748/4 "2018-12-05T07:52:10Z")

</div>

new-aduser is the powershell command to build a new user.  
[https://docs.microsoft.com/en-us/powershell/module/addsadministration/new-aduser?view=win10-ps](https://docs.microsoft.com/en-us/powershell/module/addsadministration/new-aduser?view=win10-ps)

you can use a csv file for input, so you should also read up on import-csv

> **[Import-Csv (Microsoft.PowerShell.Utility) - PowerShell](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-csv?view=powershell-7.2&viewFallbackFrom=powershell-6)**
>
> The Import-Csv cmdlet creates table-like custom objects from the items in CSV files. Each column in the CSV file becomes a property of the custom object and the items in rows become the property values. Import-Csv works on any CSV file, including...

or just a simple google search…

> **[PowerShell: Bulk create AD Users from CSV file - TechNet Articles - United...](https://social.technet.microsoft.com/wiki/contents/articles/24541.powershell-bulk-create-ad-users-from-csv-file.aspx)**
>
> Technical articles, content and resources for IT Professionals working in Microsoft technologies

> **[Browse code samples](https://docs.microsoft.com/en-us/samples/browse/?redirectedfrom=TechNet-Gallery)**
>
> Get started with Microsoft developer tools and technologies. Explore our samples and discover the things you can build.

as always, don’t run someone else’s code if you don’t understand what its doing

---

<div class="post-metadata">

**Author:** ![js2010](https://avatars.discourse-cdn.com/v4/letter/j/ebca7d/32.png) [@js2010](https://forums.powershell.org/u/js2010)\
**Post date:** [December 5, 2018, 10:03am UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748/5 "2018-12-05T10:03:16Z")

</div>

Here’s a very basic example:

Users.csv:

```
name,path
js,"OU=People,DC=powershell,DC=org"
js2,"OU=People,DC=powershell,DC=org"
```

users.ps1:

```
import-csv users.csv | new-aduser -whatif

What if: Performing the operation "New" on target "CN=js,OU=People,DC=powershell,DC=org".
What if: Performing the operation "New" on target "CN=js2,OU=People,DC=powershell,DC=org".
```

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:33pm UTC](https://forums.powershell.org/t/how-to-automate-creating-ad-users-with-powershell-and-excel/11748/6 "2024-05-16T20:33:38Z")

</div>

Closed on May 16, 2024, 8:33pm UTC


