now that we have our two data files (sqldata.txt containg BES data and ADdata.csv with AD data) we need to do some comparing.
Since we only have AD data about the terminated employees if we find a match from the sqldata.txt file we know the termed emp had a BB, and I think this was your end goal to produce a list of termd emps with BB's.
so, this is a bit of a hack but that is because we ended up with a space at the start of the data in sqldata.txt. so we end up having to call another batch file to do the searching.
create a new batch file called checkusr.bat and put this in it:
Code:
@echo off
find /i "%*" addata.csv | find /i "="
then back to the getBES.bat, it will need to have this added:
Code:
del BESterm.csv /q
for /F "skip=2 tokens=1* delims=*" %%i in (sqldata.txt) do call checkusr%%i >>BESterm.csv
ok, so when this is done you have a csv file called BESterm.csv containg the DN,legacyExchangeDN and displayName of termed employees who have a BB. just use Blat to send it to whoever has to clean it up.
the next step would be to automate the removal of the accounts and just send a report of what you did.
rich