In PowerShell, if you convert null to string, it will become an empty string.
$ ([string]($null)).GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.ObjectIf you output it:
$ ([string]($null))
$ ($null)
$If you get the count:
$ ($null).Count
0
$ ([string]($null)).Count
1 # Now it has a count after you converting that `null` to `string`.What a strange behavior of PowerShell! 😲