hawks76
Enthusiast
Enthusiast

PowerCLI in vRO Action just hangs when connecting to vCenter Server

Jump to solution

Running vRA 8.8.  Trying to connect to vcenter for a query.  When i call this, it just hangs and eventually times out.  I can run this in powershell outside vra and it works fine.  code hangs after Write-Host "connecting"

 

Import-Module VMware.VimAutomation.Core
$username = "vcenterusername"
$password = "vcenterpassword" | convertto-securestring -AsPlainText -Force
$creds = new-object -typename System.Management.Automation.PSCredential -argumentlist $username$password
$command = Get-Command Connect-VIServer
Write-Host $command
$vcenters = @("vcentername")
Write-Host "connecting"

Connect-VIServer -Server $vcenters -Credential $creds
Write-Host "Connected"
Write-Host "$(Get-VM vmname))"

Disconnect-Viserver -Server aprcldrvc01
 
I've also tried passing the username and password parameters on the Connect-Viserver and get the same thing.
0 Kudos
1 Solution

Accepted Solutions
hawks76
Enthusiast
Enthusiast

Figured it out.  Putting here for posterity for others.

 

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

putting this in my script fixed the issue.

View solution in original post

1 Reply
hawks76
Enthusiast
Enthusiast

Figured it out.  Putting here for posterity for others.

 

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

putting this in my script fixed the issue.