Try changing this line

$filter=" where samAccountName='["+$ADAccountName+"]' "

idea from... http://www.microsoft.com/technet/scriptcenter/resources/qanda/jun05/hey0621.mspx