Find samaccountnames containing spaces RRS feed

  • Question

  • I am trying to search for SamAccountNames that contain spaces anywhere in the name, but the following code doesn't work. Is this as simple as I think it is, or is it more complicated?

    get-aduser -filter "samaccountname -like ' '"

    Wednesday, March 12, 2014 2:03 PM


  • Try samaccountname -like '* *'

    The where/match option should also work, but is less efficient than using filter in the initial get-aduser command.

    • Marked as answer by KentYeabower Wednesday, March 12, 2014 2:25 PM
    Wednesday, March 12, 2014 2:18 PM

All replies