Skip to content

Instantly share code, notes, and snippets.

@KentNordstrom
Created May 3, 2018 19:47
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 KentNordstrom/132b1e84393cead7c10dfee76c6c0d2b to your computer and use it in GitHub Desktop.
Save KentNordstrom/132b1e84393cead7c10dfee76c6c0d2b to your computer and use it in GitHub Desktop.
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