Test-Port : Exception calling "EndConnect" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files\WindowsPowerShell\Modules\AutomatedLab\5.32.273\AutomatedLabRemoting.psm1:211 char:29
+ ... $portTest = Test-Port -ComputerName $param.ComputerName -Port $param. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Test-Port], MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException,Test-Port
After adding the error handling, the real problem comes to the surface:
New-LabPSSession : [Morph51-DCS001] Connecting to remote server Morph51-DCS001 failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
At C:\Program Files\WindowsPowerShell\Modules\PSFileTransfer\5.32.273\PSFileTransfer.psm1:510 char:28
+ ... $session = New-LabPSSession -ComputerName $machine -IgnoreAzureLabSo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [Write-Error], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Sometimes, 'Test-Port' throws an error like this:
After adding the error handling, the real problem comes to the surface: