Jump to content

Recommended Posts

Posted

Hi :) & :welcome:

Server 2008 R2 x64, I need help to create 100+ computers, the list is easy:

Student00

Stutend01

.

.

Student99

Teacher00

.

.

Teach22

saved them at a CSV excell and I need help to create the powershell script.

I manage to create the users script using some examples at the web but can't find computer script.

 

Thanks :pop2:for the help!

Posted

OK the command works fine.

all I need is to make a powershell script which will import the data from a CSV file out of the command:

New-ADComputer -Path "CN=CampusComputers,DC=AllStudents,DC=local" -Name "Student00" -SamAccountName "Student00" -DisplayName "Student00" -Descriptio "Description00" -Location "MerkazIT" -Enabled $true

 

Can someone help me with that ?

Thanks :)

Posted (edited)

I am not totally sure but would it be something like

 

$list = Import-Csv C:\computers.csv

foreach($entry in $list)

{

Your command replacing the parts of the line with list entry

}

 

eg New-ADComputer -Path "CN=CampusComputers,DC=AllStudents,DC=local" -Name $($entry.computerName) -SamAccountName $($entry.samAccount) -DisplayName $($entry.displayName) -Description $($entry.description) -Location $($rentry.location) -Enabled $true

 

This assuming your list has Name, SamAccountName, DiplayName, Description and Location in the csv

 

I am not sure if this is right as I do not have much experience in powershell...I will try test it here to and see my own mistake

Edited by rodent43
Posted

;) just removed the 'try' and 'catch' and it worked like a charm :-)

:clap2: to everyone helped, also my scripts for the groups and users works great now that the computers joined the AD.

is a restart a must ?

Posted
Yes, the newly-joined computer should restart to complete the domain join and begin to receive machine-level Group Policy settings from the domain.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...