AfterCreate Rule and respective PowerShell Script is not working. The corresponding log file is not updating.
Note-1. SVC user is having proper access.
2. Rule is attached to the source.
3. IQService details are added in the source.
Rule:-
$logFile = “D:\SailPoint\Script\Project\ConnectorAfterCreate.txt”
$command = “D:\SailPoint\Script\Project\TAPGeneration-AfterCreate.ps1”
$enableDebug = $true
#====================-------Helper functions-------====================
function LogToFile([String] $info) {
$info | Out-File $logFile -Append
}
#====================-------Get the request object-------====================
Try{
if($enableDebug) {
LogToFile(“Entering SailPoint rule”)
}
Add-type -path D:\SailPoint\IQService\Utils.dll;
$sReader = New-Object System.IO.StringReader([System.String]$env:Request);
$xmlReader = System.xml.XmlTextReader;
$requestObject = New-Object Sailpoint.Utils.objects.AccountRequest($xmlReader);
$requestAsString = $env:Request
#Call the client script
$command = -join ($command, " -requestString '$requestAsString'")
Invoke-Expression $command
if($enableDebug) {
LogToFile("after script")
}
}Catch{
$ErrorMessage = $.Exception.Message
$ErrorItem = $.Exception.ItemName
LogToFile(“Error: Item = $ErrorItem → Message = $ErrorMessage”)
}
if($enableDebug) {
LogToFile(“Exiting SailPoint rule”)
}
Script :-
#include utils
Add-Type -Path “D:\SailPoint\IQService\Utils.dll”;
$logFile = “D:\SailPoint\Script\Project\TAPGeneration-AfterCreateLogs.txt”
$enableDebug = $true
#mail fn
#. D:\SailPoint\Script\Project\mailFunctions.ps1;
function LogToFile([String] $info) {
$info | Out-File $logFile -Append
}
if($enableDebug) {
LogToFile(“Entering create script”)
}
if($enableDebug) {
LogToFile(“exit script”)
}
Kindly suggest if there are any issues with the rule and script.