ItMerkaz Posted July 29, 2012 Posted July 29, 2012 Hi & 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!
ChrisH Posted July 29, 2012 Posted July 29, 2012 (edited) Edit: On second thought look here: http://wiki.powergui.org/index.php/New-QADComputer Edited July 29, 2012 by ChrisH
ItMerkaz Posted July 29, 2012 Author Posted July 29, 2012 (edited) Thanks Chris for the fast reply but all that I know (from other links) and tried and failed I was hoping for something like this: http://www.telnetport25.com/2009/12/quick-post-%E2%80%93-script-to-create-lab-users-%E2%80%93-powershell-version%E2%80%A6/ which will create the computers..Thanks ahead Edited July 29, 2012 by ItMerkaz
ItMerkaz Posted July 30, 2012 Author Posted July 30, 2012 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
rodent43 Posted July 30, 2012 Posted July 30, 2012 (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 July 30, 2012 by rodent43
ItMerkaz Posted July 30, 2012 Author Posted July 30, 2012 just removed the 'try' and 'catch' and it worked like a charm :-) 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 ?
Ephelyon Posted July 30, 2012 Posted July 30, 2012 Yes, the newly-joined computer should restart to complete the domain join and begin to receive machine-level Group Policy settings from the domain.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now