ipmo activedirectory
$samaccountnames = gc "M:\it_business_systems\ADEX\Migration\users.txt"
$samaccountnames = $samaccountnames | ?{$_}

$tokens = import-csv "M:\it_business_systems\ADEX\Migration\Tokens\download_70772324.csv" -delimiter "`t"
$bes = import-csv "M:\it_business_systems\ADEX\Migration\Migration Doc\BesUsersData.csv"

foreach($samaccountname in $samaccountnames){
	try{$user = get-aduser $samaccountname -server aecuk.aec.local -properties mail
		if($user.enabled){write-host "$samaccountname`tis a valid user account" -foregroundcolor green
		}else{write-host "$samaccountname`tis a disabled user account" -foregroundcolor darkgreen}
		if($tokens."user id" -imatch "^($samaccountname)$"){write-host "`t$samaccountname has RSA Token" -foregroundcolor yellow}
		if($bes -imatch $user.mail | ?{$_."device model" -ne ""}){write-host "`t$samaccountname has Blackberry" -foregroundcolor cyan}
	}catch{write-host "$samaccountname`tis a not valid user account" -foregroundcolor red}
}
read-host "Press Enter To Continue"
