Syntax Matters


The following is an email I sent to the work team a while ago. Normally emails I send to the team are NDR in nature and or have code things in them. This one is all public domain, so might as well post. Bonus, it fills in my post a week goal when the week was slow.

TLDR || KQL syntax is super important when it comes to queries in PowerShell.

Email to Team

I worked on a ticket yesterday caused / resolved by helping the customer with syntax. Syntax is super important when you code stuff. There are tools you can use // most modern editors count quotes, and parenthesis for you, but you need more then that.. For this ticket the Customer was all WHY THIS command NOT WORK!!!! MAKE IT WORK MICROSOFT YOU DICKS YOU HATE ME, WHY DO YOU HATE ME so hard!!!! FIX IT pretty please with sugar on top!!  — not what they literally said, but what I personally read. The customer voices in my head are not always the nicest voices. The command they were running is as follows:

New-Mailboxsearch -Name “Bob Barker Likes puppies” -SourceMailbox “bob.barker@bob.com” -TargetMailbox “discoverysearchmailbox@bob.com” -SearchDumpster -ExcludeDuplicateMessages $false -SearchQuery “Sent:>09/01/2015″ -LogLevel Full

As a kid I was the embodiment of dyslexia. As an adult I don’t make write words good; you might have noticed!!! Wes sure has.  Even with me inability to properly read most anything, something about the error message and the search string looked off. After looking at it a few times the answer hit me, Keyword Query Language (KQL) syntax on the SENT query.

The customer’s Error caused by the introduction of the colon(:) before the Greater than(>) symbol. As written PowerShell reads (:>) as a string “>09…” not as user intended “Greater than the date “09…” I asked the customer to remove the colon and saved the world.

Moral of the story || syntax is important, and we publish reference documents covering how to KQL.

Search specific KQL KB – https://technet.microsoft.com/en-US/library/ms.o365.cc.searchquerylearnmore.aspx#emailproperties

Deeper KQL Reference – https://msdn.microsoft.com/library/ee558911(v=office.15).aspx

Bonus things

Bonus writing references in order of prescribed application when writing about Microsoft things:

  1. Start with The Chicago Manual of Style for a basic style guide on writing
  2. Next reference The Elements of Style for how to write better. A book some refer to by the authors name as “Stunk and White
  3. For final voice and Microsoft specific writing references, like allowed names, how to brand, voice, capitalization, how to blog, ETC use the Microsoft Style guide – removed hyperlink for public consumption, sorry.

Stuff and Storytime

Believe it or not Mills, way back when you were getting your 5-year crystal.  I worked on the Exchange team as a technical writer with a focus in DR, and HA.

Story time — During my last interview with the group hiring manager (KA). He asked me if I could think of any reason he should not hire me. My answer ” Um, well, I can’t write.  Well I mean I don’t write well. I’m somewhat famous for my typos in the MVP community” KA said – ” That’s a unique answer from an applicate trying to be hired in a writing position, I like the honesty. Don’t worry about it we have a great editing team”  I sure miss editors they made me sound so much better.

Leave a Reply