I have a huge CSV file with Firstname A and Lastname B
I want to import this and see if the user exists Within AD via Powershell, Looked around and tried to play around with some off the scripts online but I just get null values
Yes, possible and requested often. The biggest issue is that an uncommon name is most likely a 1:1 match, but a common name like John Smith could have multiple matches, so you will need determine how you are going to manage 1:MANY matches. Share the code that you have tried.
When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.
Thanks in advance.
Can you share an example of the CSV? Just a sample, 1 or 2 lines with fake data.
When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE”, in the “Visual” view you can use the format template “Preformatted”. You can go back edit your post and fix the formatting - you don’t have to create a new one.
Thanks in advance.
Import-Module ActiveDirectory
$Users = Import-Csv -Path "Drive:\Folder\File.csv"
ForEach ($User in $Users) {
$FirstName = $User.FirstName
$LastName = $User.LastName
Get-ADUser -Filter { (givenName -eq $FirstName) -and (surname -eq $LastName) }
}
I have this working to display the data I want to read the ID's which are not in AD and export them