Grab our RSS feeds Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn
myITforum.com, Powered by You.
you are not logged in

Articles

Newslinks

Links

Downloads

Site Services

Community Forums

Discussion Lists

Article Search

Newsletter

Web Blogs

FAQs

Live Support

myITforum TV

Take a Poll

Monthly Drawing

myITforum Network

User Group Directory

Our Partners

About Us

Register

Login

BRONZE PARTNER:

BRONZE PARTNER:



Industry News:




  Home : Articles : Windows PowerShell print | email | | Forums |   print | email | | Blogs |   print | email | | Wiki |   print | email | | FAQs |   print | email | Article Search  
PowerShell Script To Create New Organizational Units From A Text File


Bookmark and Share

By: Don Hite
Posted On: 10/2/2007

This article was Previously posted on Don Hite's Blog

This PowerShell script which is similar to my previous post entitled PowerShell Script To Create A New Organizational Unit will allow you to create new multiple Organizational Units (OU’s) based on names taken from a text file called NewOus.Txt rather than entering the new OU names one at a time.

Note: Be sure to change MyDomainName to your domain name and change Com if needed to reflect your sites naming.

PS1 Script:

$TextFile = GC -Path "C:\NewOus.Txt"
ForEach ($objItem in $TextFile){
$StrOUName = $objItem

$objDomain = [ADSI]"LDAP://dc= MyDomainName,dc=Com"
$objOU = $objDomain.Create("OrganizationalUnit", "ou=" + $StrOUName)
$objOU.setInfo()}

Write-Host "Your New OU's Have Been Created"


  myITforum.com ©2010 | Legal | Privacy