Mark Minasi's Reader Forum
Mark Minasi's Reader Forum
Home | Profile | Register | Active Topics | Active Polls | Members | Search | FAQ | Minasi Forum RSS Feed
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 HALP! Questions on Windows and Windows Server
 Scripting
 Import list of computer names from text file to AD
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

meloao
Here To Stay

USA
114 Posts
Status: offline

Posted - 03/22/2011 :  3:37:18 PM  Show Profile  Reply with Quote
I have a list of computernames in a text file. Is there way to automatically create computer accounts in Active Directory based on the names in the file?

jhicks
Here To Stay

USA
283 Posts
Status: offline

Posted - 03/22/2011 :  3:42:11 PM  Show Profile  Visit jhicks's Homepage  Reply with Quote
Sure there is. You can use either the Microsoft AD cmdlets or the free Quest cmdlets.

Using the AD Cmdlets:

$path="OU=Test Desktops,DC=jdhlab,DC=local"
Get-content NewCompters.txt | foreach {
New-ADComputer -Name $_.ToUpper() -SamAccountName $_.ToUpper() -Path $path -passthru
}

Jeffery Hicks
Windows PowerShell MVP

http://jdhitsolutions.com.blog
http://twitter.com/JeffHicks
http://www.ScriptingGeek.com
Now Available: Managing Active Directory with Windows PowerShell: TFM 2nd ed.
Go to Top of Page

meloao
Here To Stay

USA
114 Posts
Status: offline

Posted - 04/20/2011 :  7:56:52 PM  Show Profile  Reply with Quote
Worked like a charm, Jeffery! Thank you very much!
Go to Top of Page

mitachu
Honorable But Hopeless Addict

United Kingdom
1946 Posts
Status: offline

Posted - 06/28/2011 :  2:30:06 PM  Show Profile  Click to see mitachu's MSN Messenger address  Reply with Quote
Or, in case someone wants to do this in batch;


for /f %%d in (filename.txt) do DSADD computer -name cn=%%d,cn=computers,dc=my,dc=domain,dc=local


Tim
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Mark Minasi's Reader Forum © 2002-2011 Mark Minasi Go To Top Of Page
This page was generated in 0.16 seconds. Snitz Forums 2000