Fathers day, fender bender and splatting $PsBoundParameters

Today was one of those days you would like to forget about as soon as possible. Morning it took me around 20 minutes to drive around 2 km. 3 maybe… Whole day was busy, and in the evening I received call from my boss who wanted to push me with some soft installation. It’s disk encryption solution and it’s mainly pain in the… back. And try to find arguments to convince a person that he or she should get new and cool smart card reader for the laptop that shipped with internal one just because software vendor is not able to provide proper support for some SC readers. You can see that smile on the face? That “thank you for wasting 0.5h of my time for something I will probably have only problems with” look? And once actual encryption will start – that “thank you for not being able to get my data back ‘cause I haven’t had time to do backup (THAT IS ALL YOUR FAULT!) and decrypting of drive lasts for ages” stare?

But that was only a beginning. Bright side was playing with PowerShell Plus console/ editor. It’s really cool! While playing with Quest cmdlet I decided that I need some function to narrow user searches to my location only. I decided to try splat something this time. And to be more geeky – to use $PsBoundParameters variable to do job for me. That’s what I come up with:

PowerShell, using GeSHi 1.0.8.8
  1. function GetWADuser {
  2. #requires -version 2.0
  3. param (
  4.         [switch]$Locked,
  5.         [switch]$Disabled,
  6.         [string]$FirstName,
  7.         [string]$LastName,
  8.         [string]$UserPrincipalName,
  9.         [string]$Email
  10. )
  11.         $WAR = ‘OU=WAR,DC=EU,DC=PXL,DC=INT’
  12.         GetQADUser @PsBoundParameters SearchRoot $WAR
  13. }

As you can see I’ve narrowed also parameters, but than – I haven’t used many others in global searches. And with that I can get rid of –SearchRoot when I want to return all user objects in my OU.

Soooo I finally left job, and was driving home listening to the PowerScripting podcast (recent episode). And than it was: a car I was sure already turned haven’t moved, and assuming it was not there anymore – I tried to turn too. Result as expected – not very bad, bad not good either. I wish I looked one last time before I started to speed up. 😦 It was of course all my fault, so I was happy that other driver was very kind and calm. I hope it was not serious. It did not look like something serious, but with that type of collision – you never know. I finally got home, expecting some surprise. And there it was: chocolate. With peanuts! 😦 Last year, even though I was at hospital with my daughter, I got brilliant card, with her hand and son’s feet. I still have it on my desk at work. I was hoping for replacement, but no – I will have to keep old ones. And I will have a desert tomorrow! Wonderful! (and yes, it was sarcasm). I don’t blame my wife, don’t get me wrong. I know that kids are hard to grasp and she does a great job with them. But still, I was little disappointed.

But I got my present: just before kids went to bed my daughter told me those magic words that people love to hear, and very often – love to say. Son would say the same I guess, but he’s not very fluent in Polish yet. 😉 Anyway: I knew than that whole this mess all they long was not so important. I’m father and today was my day. 😀 So today was hard day. But in the end – I’m glad. And happy. And those cards were so cool, that I’m happy I have good excuse to keep them for another year. 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s