Jump to content

Recommended Posts

Posted

Hi All

 

We got a customer which is education based who enroll 100's of students every semester. and some students try to pull oone on the teacher saying they dont have an account when they do on AD so it leaves us sometimes creating multiple / duplicate accounts so they will have their main one Username then duplicate Username1

 

We dont have enough time to individually check the new users names on AD to see if they got an account already

 

Is there a tool that will scan a CSV file - and detect to see if there is a user with that name already created?

 

Thanks,

Sam

Posted (edited)

You can do this fairly easily with a powershell script. Here is one we use that sounds like it might be what you're after:

 

# Access Active Directory PowerShell Commands.Import-Module ActiveDirectory -ErrorAction SilentlyContinue# Import List Of Accounts From CSV.$ListOfAccounts=IMPORT-CSV C:\Scripts\CSVs\2020leavers.csv -Header ("Email")FOREACH ($Account in $ListOfAccounts){        # If the account exists, inform, if it does not exist also inform.    $Username = $Account.Email    If ((Get-ADUser -Filter "EmailAddress -eq '$($Account.Email)'") -eq $Null)    {       $username | out-file "C:\Scripts\CSVs\not-exists.log" -append       Write-Host "$Username does not exist."    }    Else    {       $username | out-file "C:\Scripts\CSVs\exists.log" -append       Write-Host "$Username exists."    }}

 

Pasting the code isn't going to well so I have put it here:

https://paste.ofcode.org/9mPvhPgST2AW6GU8WGV5in

 

 

You can change the filter to SAMACCOUNTNAME if you want to use their account name rather then email address.

Edited by RLR
  • Thanks 1
Posted (edited)

So how do accounts get created?

 

Is it automated, what system/app do you use to create the AD accounts?

 

Student claims no account is this verified by staff member that they are typing correct name?

How does CSV run to create account when it is claimed it is missing?

 

I created powershell scripts at a previous employment to create AD accounts and that could check if accounts existed at the end and email me a report. We never had duplicate AD names because the script was not set to append number on duplicate names.

Edited by Davit2005

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...