You just use an if statement or a try catch statement and put in the message you want.
($UrlOrIPA = 'stackoverflow.com')
($UrlOrIPA = '10.0.119.61:8101')
try
{
curl -Uri $UrlOrIPA -UseBasicParsing | Select Status*
"Testing $UrlOrIPA"
'Success'
}
catch
{
"Testing $UrlOrIPA"
'Failure'
}
StatusCode StatusDescription
---------- -----------------
200 OK
Testing stackoverflow.com
Success
Testing 10.0.119.61:8101
Failure
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.