Update: AAD Connect Network Test Tool

I trotted out the trusty WireShark and Fiddler tools today and ran through the latest iteration of AAD Connect setup.  In so doing, I’ve added a few endpoints to the test:




As always, the newest version is available at… [ Continue reading ]


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
PS C:\> $IntValue1
PS C:\> If ($IntValue0) { "exists" }
PS C:\> If ($IntValue1) { "exists" }
PS C:\> if ($StringValue0) { "exists" }
PS C:\> if ($StringValue1) { "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 ]