Recently, I was in the need to change the description on multiple Active Directory accounts that I had exported from an OU to CSV. They were over 500 so doing it one by one would have been a time consuming task. That's when I decided to do a simple by working script to accomplish this task.
I'm using Powershell but you can other languages such as VBS. I prefer Powershell because it's more robust yet simpler to use and understand and it's the future of Windows Scripting.
Here's the script:
##############################################################
# Change-Description-To-Users.ps1 #
# Created by tips4teks.blogspot.com #
# This script changes the description of AD accounts to whatever is specified #
##############################################################
Import-module ActiveDirectory
#Declare the path to the CSV file where you have the accounts by Distinguished Name.
#The first row of the column should be named "DistinguishedName" without quotes.
$CSV='C:\users-to-edit.csv'
#Declare the new description that will be applied to all the accounts in the CSV file.
$Description='Account Disabled by tips4teks.blogspot.com'
#Read the CSV file and change the description to each user object based on the parameters specified.
import-csv -path $CSV | foreach-object { Set-ADUser -identity $_.DistinguishedName -Description $Description}
I'm using Powershell but you can other languages such as VBS. I prefer Powershell because it's more robust yet simpler to use and understand and it's the future of Windows Scripting.
Here's the script:
##############################################################
# Change-Description-To-Users.ps1 #
# Created by tips4teks.blogspot.com #
# This script changes the description of AD accounts to whatever is specified #
##############################################################
Import-module ActiveDirectory
#Declare the path to the CSV file where you have the accounts by Distinguished Name.
#The first row of the column should be named "DistinguishedName" without quotes.
$CSV='C:\users-to-edit.csv'
#Declare the new description that will be applied to all the accounts in the CSV file.
$Description='Account Disabled by tips4teks.blogspot.com'
#Read the CSV file and change the description to each user object based on the parameters specified.
import-csv -path $CSV | foreach-object { Set-ADUser -identity $_.DistinguishedName -Description $Description}
Change Description to Multiple AD Accounts via Powershell Script