Solved

Creating Computers with Powershell

Posted on 2013-01-23
3
189 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 40

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Set OWA language and time zone in Exchange for individuals, all users or per database.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

839 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