Test WebClient API call
问题 I have the following PowerShell script that makes an API Rest GET call. $FullURL = "http://test.net/config/server/$($env:COMPUTERNAME)?format=test" $API = New-Object System.Net.WebClient $APIData = $API.DownloadString($FullURL) Set-Content -Value $APIdata -Path $APIDataFile -Force The call is dependent on the local hostname in the URI. It gets the data and exports to a text file as a backup. The problem - the API host maybe down or no information available for the host which will cause all