How to get the url status

i am trying to get the status of different urls but it is returning me 200 ok for all urls. How can i get the url status and perform a task as per url status like status is 200, 503, 404.
Also getting below error but the url is working fine for me, i just want to know url is working or not(i want to ignore the below error and just want check url is up or not)
“Invoke-WebRequest : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS
secure channel.”

This is my code

[string]$sites = ( “https://sdfad.asd.sd”,
https://www.google.co.in/”,
Bing”)

foreach ($site in $sites)
{
$securepassword = ConvertTo-SecureString “Password” -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential(“Username”, $securepassword)
$status = (Invoke-WebRequest -Uri $site -Credential $credentials).statuscode
if ($status -eq 200)
{
write-host ‘success for site’ $site
}else{
write-host ‘failure for site’ $site
}
}