Force Network Connectivity tests to use an array
So this is a funny bug I've stumbled upon. In some environments, the $uniqueURLs was defined as a string instead of an array, leading this unexpected results.
The value was initialized using the results of dsregcmd. In some scenarios, such as a device not being registered/joined to any domain, it would only contain one value "www.microsoft.com", and because of that, Powershell would return that as a string, instead of an array. This led to the following lines to concatenate a string before doing network connectivity tests. Resulting in this wonderful result:
Error connecting to www.microsoft.comr.manage.microsoft.comr.manage.microsoft.usenterpriseregistration.windows.net: Exception calling "Wait" with "1" argument(s): "One or more errors occurred." Able to connect to port 443 on www.microsoft.comr.manage.microsoft.comr.manage.microsoft.usenterpriseregistration.windows.net : False
That is an hilariously long URL that doesn't exist.
This changes force the variable to be initialized as an array THEN proceeds to add the dsregcmd values and other URLs to the mix.