you would do it like below
Get-ADUser -filter "DisplayName -like '*$lastName*$firstName*'"
you would do it like below
Get-ADUser -filter "DisplayName -like '*$lastName*$firstName*'"
[quote quote=167221]you would do it like below
E.g.
Get-ADUser -filter "DisplayName -like `"*$lastName*$firstName*`""
I get the same result, but I suppose the single quotes way is cleaner.
unless escaped or using here strings, same type of quotes cannot be used with in them.
The filter isn’t really a script block, but it seems like everybody uses it, even the online help.
Thank you both for the information!