Crampy Posted September 10, 2020 Posted September 10, 2020 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
RLR Posted September 10, 2020 Posted September 10, 2020 (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 September 10, 2020 by RLR 1
Davit2005 Posted September 10, 2020 Posted September 10, 2020 (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 September 10, 2020 by Davit2005
Crampy Posted September 10, 2020 Author Posted September 10, 2020 We are currently using XIA Automation to create the accounts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now