📅  最后修改于: 2022-03-11 14:50:36.630000             🧑  作者: Mango
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
}