I have following powershell script to get LDAP properties. I would like to pass the BadgeID as variable instead of hard coding it. The LDAP query is working with hard-coded Badg
Reverse the quotes of your filter expression:
Get-ADUser -Filter "BadgeID -like '*$BadgeID*'" ...
Variables are expanded in double-quoted strings, but not in single-quoted strings.