+ Post New Thread
Results 1 to 9 of 9
Windows Server 2008 R2 Thread, PowerShell script to create cmputers in Technical; Hi & Server 2008 R2 x64, I need help to create 100+ computers, the list is easy: Student00 Stutend01 . ...
  1. #1

    Join Date
    Jul 2012
    Location
    Hollyland, ISRAEL
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question PowerShell script to create cmputers

    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 for the help!

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,987
    Thank Post
    120
    Thanked 283 Times in 261 Posts
    Rep Power
    107
    Edit: On second thought look here: http://wiki.powergui.org/index.php/New-QADComputer
    Last edited by ChrisH; 29th July 2012 at 04:38 PM.

  3. #3

    Join Date
    Jul 2012
    Location
    Hollyland, ISRAEL
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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/...sion%E2%80%A6/
    which will create the computers..Thanks ahead

    Last edited by ItMerkaz; 29th July 2012 at 06:22 PM.

  4. #4

    Ephelyon's Avatar
    Join Date
    Aug 2008
    Location
    Cheshire, England
    Posts
    1,708
    Thank Post
    299
    Thanked 328 Times in 201 Posts
    Rep Power
    143
    Does it have to be PowerShell?

  5. #5

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,258
    Thank Post
    671
    Thanked 1,644 Times in 1,466 Posts
    Rep Power
    424
    Can't you just use dsadd?

    dsadd computer <ComputerDN>

    Ben

  6. #6

    Join Date
    Jul 2012
    Location
    Hollyland, ISRAEL
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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

  7. #7

    Join Date
    Jul 2012
    Posts
    38
    Thank Post
    11
    Thanked 2 Times in 2 Posts
    Rep Power
    5
    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
    Last edited by rodent43; 30th July 2012 at 04:04 PM.

  8. #8

    Join Date
    Jul 2012
    Location
    Hollyland, ISRAEL
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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 ?

  9. #9

    Ephelyon's Avatar
    Join Date
    Aug 2008
    Location
    Cheshire, England
    Posts
    1,708
    Thank Post
    299
    Thanked 328 Times in 201 Posts
    Rep Power
    143
    Yes, the newly-joined computer should restart to complete the domain join and begin to receive machine-level Group Policy settings from the domain.

SHARE:
+ Post New Thread

Similar Threads

  1. Script to create a VPN connection
    By Norphy in forum Scripts
    Replies: 5
    Last Post: 20th April 2010, 11:37 AM
  2. Replies: 0
    Last Post: 24th January 2008, 02:58 PM
  3. VB Script to create folders
    By markesmith in forum Scripts
    Replies: 2
    Last Post: 26th April 2007, 03:03 PM
  4. Script to Create My Documents Subject Folders
    By SwedishChef in forum Scripts
    Replies: 15
    Last Post: 5th July 2006, 08:14 AM
  5. Script to create a local user on a XP box.
    By tosca925 in forum Scripts
    Replies: 3
    Last Post: 12th October 2005, 12:04 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •