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

My short lesson: when setting an integer value to 0, you can’t test for it using If ($Value), as that will return false. … [ Continue reading ]

Personal

Update: Create-LabUsers Tool

Just when you thought it couldn’t get more awesome.

It has.

By popular request, I have added a few new features (and fixed an annoyance).  First, the bug fix:

-Count 1

Yes, it’s true. If you ran the Create-LabUsers script with -Count 1 with the -InflateMailboxes parameter, you’d run into an issue because of how I calculated the $MaxRecipients value. … [ Continue reading ]

Configuration

Update to Create-LabUsers tool

Update: I’ve added a shortlink for this tool: http://aka.ms/createlabusers.

Because you didn’t ask for it, I went ahead and added to it.

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. 
[ Continue reading ]
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

Office 365 Administration Inside Out

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!

You can read the press release here: https://blogs.msdn.microsoft.com/microsoft_press/2017/11/27/new-book-microsoft-office-365-administration-inside-out-includes-current-book-service-2nd-edition

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/

Ed Fisher, https://blogs.technet.microsoft.com/edfisher/[ Continue reading ]

Information

Office 365 Administration Inside Out

I meant to post this earlier, but I wanted to let everyone know that I’ve had the great honor of being able to write a book with some of the titans of Microsoft Consulting Services.  The book has all new content for Office 365 based on our experience in the field, and even features current service release updates. … [ Continue reading ]