Script repository
The script executes the code from a business rule, custom command or scheduled task in a new PowerShell instance. The approach does not allow retrieving any data from the external instance.
Parameters
$waitTimeMilliseconds- the time during which Adaxes will wait for the script to complete. It is recommended not to set a time exceeding the 10 minutes limit applied by Adaxes to scripts executed by business rules, custom commands and scheduled tasks.$scriptBlock- the PowerShell script that will be executed in the new PowerShell instance.
$waitTimeMilliseconds = 9 * 60 * 1000 # TODO: modify me
$scriptBlock = {
Import-Module Adaxes
$resource = 'https://api.example.com/users'
$userDN = 'CN=John Doe,CN=Users,DC=example,DC=com'
$user = Get-AdmUser -Identity $userDN -AdaxesService localhost | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri $resource -Body $user
} # TODO: modify me
# Start a new instance of Windows PowerShell and run the script.
$powershellPath = "$env:windir\system32\windowspowershell\v1.0\powershell.exe"
$process = Start-Process $powershellPath -NoNewWindow -ArgumentList ("-ExecutionPolicy Bypass -noninteractive -noprofile " + $scriptBlock) -PassThru
$process.WaitForExit($waitTimeMilliseconds)
Comments 0
You must be signed in to comment.