Functions/workflow-service/Export-vROWorkflowIcon.psm1
function Export-vROWorkflowIcon { <# .SYNOPSIS Export a vRO Workflow Icon as a PNG file .DESCRIPTION Export a vRO Workflow Icon as a PNG file .PARAMETER Id Specify the ID of the vRO Workfow .PARAMETER File Specify the Filename to export to - should be a PNG file .INPUTS System.String .OUTPUTS System.IO.FileInfo .EXAMPLE Export-vROWorkflowIcon -Id "3f92d2dc-a9fa-4323-900b-ef97196184ea" -File C:\Icons\Test01.png .EXAMPLE Get-vROWorkflow -Name Test01 | Export-vROWorkflowIcon -File C:\Icons\Test01.png #> [CmdletBinding()][OutputType('System.IO.FileInfo')] Param ( [parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelinebyPropertyName=$true)] [ValidateNotNullOrEmpty()] [String]$Id, [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String]$File ) begin { } process { foreach ($WorkflowId in $Id){ try { $URI = "/vco/api/workflows/$($WorkflowId)/icon" $Headers = @{ "Content-Type" = "image/png"; "Authorization" = "Basic $($Global:vROConnection.EncodedPassword)"; } # --- Run vRO REST Request Invoke-vRORestMethod -Method GET -Headers $Headers -URI $URI -OutFile $File -Verbose:$VerbosePreference # --- Output the result Get-ChildItem -Path $File } catch [Exception]{ throw } } } end { } } |