Information

Testing a variable with the value of zero

Tonight, while working on my previous script, I ran into an interesting problem when testing the presence of a value.

Consider this:

PS C:\> [int]$IntValue0 = 0 PS C:\> [int]$IntValue1 = 1
PS C:\> [string]$StringValue0 = "0" PS C:\> [string]$StringValue1 = "1"
PS C:\> $IntValue0 0 PS C:\>$IntValue1
1
PS C:\> If ($IntValue0) { "exists" } PS C:\> If ($IntValue1) { "exists" }
exists
PS C:\> if ($StringValue0) { "exists" } exists PS C:\> if ($StringValue1) { "exists" }
exists
PS C:\> if ($IntValue0 -eq$null) { "null" }
PS C:\> if ($IntValue0 -lt 1) {"less than 1" } less than 1 PS C:\>$IntValue0.GetType()

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType

Configuration

Update to Create-LabUsers tool

Well, that’s a lie.  I actually had some really great ideas and feedback, so I’ve added a few new features that I wanted to draw attention to:

• Detect existing Exchange session – If you cancel the script to create mailboxes while it’s running, you previously needed to run a Remove-PSSession to close the open Exchange session.
Personal

Random things with Get-Random

Today’s post is less about anything in particular than it is about jotting a few things down for personal reference.

I learned a couple of things over the last week while developing a tool. I’m sure I learned them once before, but as a person with finite storage and recall capacity, this tidbits were replaced by something I perceived to be of more timely import at the time (such as my kids’ birthday gifts, picking up a suit at the cleaners, a really great Detroit style pizza recipe I’ve finally put the finishing touches on, and how I’ve recently become a fan of grass-fed butter (well, technically butter made from milk produced by grass-fed cows, since you can’t really get butter to eat anything successfully)).… [ Continue reading ]

Information

Hey! It’s finally here! After months of hard work (almost a year from when we started until a copy at my doorstep), we’ve finally made it to the finish line!  Also, pay no mind to my poor cuticles!

Or jump straight to Amazon and order it: http://aka.ms/o365adminio

While you’re at it, be sure to check out the blogs of the other authors, filled with all sorts of goodies:

Darryl Kegg, https://aka.ms/dkeggblog

Lou Mandich, http://blogs.technet.com/b/loum/

Information