Today, I got a good question from a friend of mine. Let’s call my friend Steve, after all his name is Steve. Anyhow, my friend wanted to return all users within a domain that did not have a ByteArray value of FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF for the logonHours attribute. Naturally, I said to myself that is easy enough, here is your filter statement:
!(logonHours=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
Yeah… that did not work. So, I consulted my second brain: Google. Didn’t see anything right off the bat, but that must have been because I was using the wrong search terms. Oddly enough, I then heard this nagging voice in the back of my mind: “Tyson, you know this”. It took me a minute, and I then realized that I not only knew the topic at hand, but I even wrote about it in the 2nd Edition of the Windows PowerShell Unleashed book:
Lastly, if the search filter contains binary data, then that data needs to be represented such that each byte of the binary data is escaped using a backslash “” followed by two hexadecimal digits. For example to retrieve the object with GUID = “659cd735f7fc4182b007b650b621d4de” you would use the following filter statement.
“(objectGUID=659cd735f7fc4182b0




