Solved

Creating Computers with Powershell

Posted on 2013-01-23
3
186 Views
Last Modified: 2013-01-24
I am wanting to create computers in AD automatically by prompting the user for a prefix, a starting number, and how many new computer to create.

How can I do this?
0
Comment
Question by:Joseph Moody
3 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 38811801
Are you talking about creating computer accounts in AD? Can you give an example on how you want to do it?

In PowerShell you can use New-ADComputer command to create computer accounts..
http://ss64.com/ps/new-adcomputer.html
0
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 38814104
Import-Module ActiveDirectory
$prefix = Read-Host "Enter prefix"
try { [int]$startnumber = Read-Host "What's the starting number?" -ea "Stop"}
catch {"Need to enter a number"; break}
try { [int]$number = Read-Host "How many computer accounts do you want to create?" -ea "Stop"}
catch {"Need to enter a number"; break}
ForEach ($i in ($startnumber..($startnumber + $number -1)))
{
  $compName = $prefix + $i
  New-ADComputer -name $compName
}

Open in new window

0
 
LVL 22

Author Closing Comment

by:Joseph Moody
ID: 38815838
Genius!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now