Home ACTIVE DIRECTORY How to create bulk of Computer Objects with PowerShell

How to create bulk of Computer Objects with PowerShell

by Cengiz Kuskaya

Creating bulk of computer objects with Powershell :

There might be times where you should create hundreds of Computer Objects in Active Directory. We can do it basically as follows with Powershell.

First we have to create a *.CSV file. Afterwards type into the first cell “ComputerAccount” without the quotation marks and list the computer names. Every computer object name in a new row like in the screenshot below. Save it under "C:\Scripts\NewComputerObjects.csv" and run the Powershell command.

NewComputerObjects

Powershell Script :

Import-Module ActiveDirectory
$CSV="C:\Scripts\NewComputerObjects.csv"
$OU="OU=CengizTestOU,DC=kuskaya,DC=com"
Import-Csv -Path $CSV | ForEach-Object {New-ADComputer -Name $_.ComputerAccount -Path $OU -Enabled $True}

Good luck !