I'm using PowerShell v2 and Microsoft's AD module to search our AD for accounts whose EmployeeID match a particular ID. The ID is usually stored in AD as "00000123456" but the value i have to search with is only the "123456" part. problem is i cannot figure out how to do a -like search in AD. here's my current code
$EmpInfo = Import-csv "PSfile.csv"
$EmplID = EmpInfo.ID
$EmpAD = get-aduser -Filter {employeeId -like "*$EmplID"} -Properties * -EA Stop
At this point, EmpAD is always empty
I can work around this by modifying EmpID to contain "*123456" before I call Get-ADUser and this works. But I can't help but think there is a syntax problem preventing the obvious approach. Research to resolve it has been fruitless.