try {
Write-debug "Connecting to vCenter, please wait.."
#Connect to vCenter
Connect-ViServer -server $vcInfo.server -credential $creds -ErrorAction Stop | Out-Null
}
catch [Exception]{
$status = 1
$exception = $_.Exception
Write-debug "Could not connect to vCenter"
$msg = "Could not connect to vCenter"
LogSysTo-File $msg $status $env:username $exception.message
}