Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating Computers with Powershell

Posted on 2013-01-23
3
Medium Priority
?
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 41

Accepted Solution

by:
footech earned 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

604 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