Skip to main content

Executor Cmdlets

Reference for Governor Executor Cmdlets

Get-GovernedObject

Synopsis Request governed object from Governor Engine.

The Get-GovernedObject Cmdlet is only available in Governor Executor Scripts. It is not available to Observer Scripts.

Syntax

Get-GovernedObject [[-Id] <string>] [[-Alias] <string>] [[-ConfigurationType] <string>]

Examples

$target = Get-GovernedObject -Id $Order.GovernedObjectId -ConfigurationType "AzureADUser"
$target = Get-GovernedObject -Alias "SKU:12345678-1234-1234-1234-1234567890ab" -ConfigurationType "M365SubscribedSku"

Get-GovernedObjectChildren

Synopsis List child objects of a governed object.

Syntax

Get-GovernedObjectChildren
[[-Id] <string>]
[[-Alias] <string>]
[[-depth] <int>]
[[-ConfigurationType] <string>]

New-ExecutionResult

Synopsis Create a new ObservationResult to report back to the Governor Engine.

Syntax

New-ExecutionResult
[-ConfigurationType] <string>
[-Action] <string>
[-ObjectId] <string>
[-Reason] <string>
[-Updates] <psobject>
[-Cooldown <int>]
[-ItemId <string>]
[<CommonParameters>]

Examples

New-ExecutionResult -ConfigurationType "AzureADUser" -Action "AzureADUser/Create" `
-ObjectId $Order.GovernedObjectId -Reason "User created" -Updates @{
"UserCreated" = $true
} -Cooldown 15

New-ExecutionError

Synopsis Create a new ObservationError to report back to the Governor Engine.

Syntax

New-ExecutionError
[-ExecutionType] <string>
[[-ObjectId] <string>]
[-Message] <string>
[-Reason] <string>
[-Repeat]
[-Cooldown <int>]
[<CommonParameters>]

Examples

New-ExecutionError -ExecutionType "AzureADUser/Create" -ObjectId $Order.GovernedObjectId `
-Reason "AAD connection failed" -Message $_.Error[0].ToString() -Repeat -Cooldown 300
New-ExecutionError -ExecutionType "AzureADUser/Create" -ObjectId $Order.GovernedObjectId `
-Reason "Login failed" -Message $_.Error[0].ToString()