Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script that checks if Requests to the FIMService are still in PostProcessing mode.
<#
.SYNOPSIS
Script that waits for WF triggered by requests.
Used in Schedules to get dynamic sleep time before importing results after export to FIM Service.
Default Creator is Built-in Synchronization Account.
Requires the LithnetRMA PowerShell module from https://github.com/lithnet/resourcemanagement-powershell
#>
PARAM(
[string]$Creator = 'fb89aefa-5ea1-47f1-8890-abe7797d6497',
[string]$FIMServiceURI = "http://fimservice.konab.net:5725",
[int]$RetryInterval = 5
)
#region Lithnet
if(!(Get-Module -Name LithnetRMA)){Import-Module LithnetRMA}
Set-ResourceManagementClient -BaseAddress $FIMServiceURI;
#endregion Litnet
$Running = Search-Resources -xPath "/Request[Creator='$Creator' and RequestStatus='PostProcessing']"
while($Running)
{
Start-Sleep -Seconds $RetryInterval
$Running = Search-Resources -XPath "/Request[Creator='$Creator' and RequestStatus='PostProcessing']"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.