# Setting Active Directory OU '-Path' parameter

**URL:** <https://forums.powershell.org/t/setting-active-directory-ou-path-parameter/1727>\
**Category:** PowerShell Help\
**Created:** [July 16, 2013, 4:20am UTC](https://forums.powershell.org/t/setting-active-directory-ou-path-parameter/1727 "2013-07-16T04:20:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thickgit](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@thickgit](https://forums.powershell.org/u/thickgit)\
**Post date:** [July 16, 2013, 4:20am UTC](https://forums.powershell.org/t/setting-active-directory-ou-path-parameter/1727/1 "2013-07-16T04:20:25Z")

</div>

Evening All,

Quick one…

I’m trying to write a script to help with user AD account creation. (Import-CSV and New-ADUser)

One of the CSV file headers is ‘Area Number’. The column’s cell contents will contain only either a 1, 2 or 3 (and unfortunately not ‘Area1’, ‘Area2’ or ‘Area3’). The format of the input CSV file can’t be changed.

I’m trying to set the -path parameter to place the new user in the correct OU:

‘ou=Area1,ou=suppliers,ou=Europe,dc=company,dc=com’

However, I can’t get the first part (ou=Area) to work. I’ve tried variations of:

‘ou=Area + $\_.“Area Number”,ou=suppliers,ou=Europe,dc=company,dc=com’

I’ve messed around with the positioning of the quotes and the ‘+’ symbol (including and omitting it).

I’m sure this is something simple that I’m going to kick myself over.

Please put me out of my misery!

---

<div class="post-metadata">

**Author:** ![richard-siddaway](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@richard-siddaway](https://forums.powershell.org/u/richard-siddaway)\
**Post date:** [July 16, 2013, 4:52am UTC](https://forums.powershell.org/t/setting-active-directory-ou-path-parameter/1727/2 "2013-07-16T04:52:05Z")

</div>

Either of these should work

```
Import-Csv area.csv |
foreach {

'ou=Area' + $_."Area Number" +',ou=suppliers,ou=Europe,dc=company,dc=com'

"ou=Area$($_.'Area Number'),ou=suppliers,ou=Europe,dc=company,dc=com"

}
```

assuming a CSV file of

“Area Number”  
1  
2  
3  
2  
3  
1  
5

---

<div class="post-metadata">

**Author:** ![thickgit](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@thickgit](https://forums.powershell.org/u/thickgit)\
**Post date:** [July 16, 2013, 5:05am UTC](https://forums.powershell.org/t/setting-active-directory-ou-path-parameter/1727/3 "2013-07-16T05:05:46Z")

</div>

I tried them both.

The 2nd one worked. Many thanks for your help, Richard. Much appreciated!

---

<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:57pm UTC](https://forums.powershell.org/t/setting-active-directory-ou-path-parameter/1727/4 "2024-05-16T20:57:41Z")

</div>


