Bulk Create Computer Accounts With PowerShell - Risual

Risual is now

Node4 Go to Node4 Continue to risual.com Careers Risual Logo
  • Hello Portal
  • Contact
×

Hi All ,

I recently had a requirement to pre-create 30 computers accounts in Active Directory for computers that had not yet been domain joined.

To do this I used a script to generate the computer accounts. Using this script, you can pull the computer names from a CSV file and create them in a specific OU automatically.

1) Create a new CSV file in excel with a column called ‘computer’ and a list of computer names. Save the CSV in location accessible by your domain controller.

2) Determine the distinguished path for the OU that the computer accounts will be created. If you have a similar computer you can get this by running ‘Get-ADCompuer “DESKTOP01” | fl’ and looking for the ‘DistingushedName’ attribute.

3) Run the following in PowerShell on your domain controller. Ensure that you have the OU and CSV variables set correctly as above.

Import-Module ActiveDirectory

$CSV=‘C:path-to-csvComputers.csv’

$OU=‘OU=Devices,DC=risualblogs,DC=com’

Import-Csv -Path $CSV | ForEach-Object { New-ADComputer -Name $_.Computer -Path $OU -Enabled $True}

Hope this helps

SHARE

About the author

risual

Experts in transformation

© risual Copyright 2017 - 2021

Terms & Conditions | Privacy Policy

Website by Kanuka Digital

Tag » Add Computer Object In Active Directory Powershell