I'm trying to query users from an AD OU specifically looking for attribute TsAllowLogon. My attempts at running a command in PowerShell have been unsuccessful. Any help were I'm messing up this command would be greatly appreciated. Usually it just generates an empty CSV file.
Get-ADUser -ResultSetSize $null -SearchBase $ou -SearchScope SubTree -LdapFilter "(TsAllowLogon=$False)" | Select-Object Name,samAccountName | Export-Csv -NoTypeInformation $("C:\results\" + $name + "TsAllowLogonFalse.csv")