Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Get-vROWorkflow By Id
$Credential = Get-Credential
$Username = $Credential.UserName
$Password = $Credential.GetNetworkCredential().Password
# --- Deal with certificate issues
# --- Note: this code will disable certificate checking
# --- for this PowerShell session
if (-not ("TrustAllCertsPolicy" -as [type])){
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
}
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
# --- Create REST Headers
$Auth = $Username + ':' + $Password
$Encoded = [System.Text.Encoding]::UTF8.GetBytes($Auth)
$EncodedPassword = [System.Convert]::ToBase64String($Encoded)
$Headers = @{"Authorization"="Basic $($EncodedPassword)";}
$Server = "vraap02.vrademo.local"
$WorkflowId = "f6dc3b0b-5c46-42ef-a8a0-9418fa49eb71"
$URI = "https://$($Server):8281/vco/api/workflows/$($WorkflowId)"
$Workflows = Invoke-RestMethod -Method Get -Uri $URI -Headers $Headers -ContentType "application/xml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment