Hi All,
I'm trying to write a script where I have a CSV with First_Name,Last_Name,DOB. What I would like is for my script to search through a defined OU and add the information from the DOB column to the user. After the script looks at the right OU I want it to look through each user and find the ones that have a First_Name entry to match with someones $user.GivenName and Last_Name match $user.SurName. Once it does that it will add the information next to their name in the DOB (Birthdays) in that user's Notes section in their AD profile. I thought I had it right but I think I am off but here's the current script:
#==============================================================================
# File: notesCSV.ps1
# Author: Jason Singh
# Date: 07/01/2016
#==============================================================================
#This is needed to supress errors, in this case to supress null path errors.
#$ErrorActionPreference = "SilentlyContinue"
#Imports AD module...
Import-Module ActiveDirectory
Import-CSV c:\Test.csv
foreach ($user in $users) {
Get-ADUser -Filter "First_Name -eq '$($user.GivenName)' And Last_Name -eq '$($user.SurName)'" -Properties * -SearchBase "OU=Students,OU=xxxx,DC=xxxxx,DC=xxxxxx" |
Set-ADUser -Replace @{info="$($_.info) DOB"}
}
And an example CSV would be:
First_Name,Last_Name,DOB
John,Smith,01/18/2016
Jane,Doe,08/04/1998
Any help is appreciated, thanks!