Hi,
I'm trawling my domain for AD accounts with multiple x400 addresses using the -Like switch. The results are being written to a local DB, to query late.
However, using -Like only returns 'True' or 'False' for the proxyaddresses, and returns all user accounts with that true or false value (not great with a large AD). What I was hoping to obtain was the actual value of the proxyaddresses attribute, and ONLY the accounts that contain multiple
Can anyone tell me if -Like is the best option, and if not what might be more efficient?
Script -
Get-qaduser -IncludeAllProperties -SerializeValues -SizeLimit 0 | select samaccountname,proxyaddresses | foreach {
$sql= "INSERT INTO robdb.dbo.Test_tbl ( samaccountname,proxyaddresses ) VALUES ( '{0}','{1}' )" -f $_.SamAccountName, ( $_.proxyaddresses -join ";" -like "*X400:c*X400:c*" )
invoke-sqlcmd $sql
}
Thanks,
Rob