Answers for "powershell try catch connect-viserver"

0

powershell try catch connect-viserver

  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
  }
Posted by: Guest on September-25-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language