Skip to content

Instantly share code, notes, and snippets.

@jonathanmedd
Created March 30, 2016 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanmedd/a28b1cbb6b7b071b9b1e3636f91d917e to your computer and use it in GitHub Desktop.
Save jonathanmedd/a28b1cbb6b7b071b9b1e3636f91d917e to your computer and use it in GitHub Desktop.
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