Which IIQ version are you inquiring about?
8.3p4
Share all details about your problem, including any error messages you may have received.
I’m attempting to execute Powershell script via the RPCService. Thus far, I am able to call the service and execute the Powershell script, which will write to a txt or csv file, and then I can read back the file. That’s the “easy” part, and completely acceptable for the time being. What I’d like to do is take this a step further and eliminate writing to and reading from a file, and return a value from the Powershell script back to IIQ. It appears to be possible from other posts I have read, but I’m not receiving any values back and have not found any solutions. I’m not getting any errors, just the standard RPCResponse
This is the IIQ rule I’m using to call the RPCService
Map data = new HashMap();
Application ad = context.getObjectByName(Application.class, "ActiveDirectory");
Rule theRule = context.getObjectByName(Rule.class, "SourceRule");
AccountRequest acctReq = new AccountRequest();
acctReq.setApplication("IIQ");
acctReq.setNativeIdentity("FAKE");
acctReq.setOperation(AccountRequest.Operation.Modify);
acctReq.add(new AttributeRequest("targetUser","USERID"));
data.put("Request",acctReq);
data.put("Application", ad.getAttributes());
data.put("postScript", theRule);
RPCService service = new RPCService("IQService_Server", 5055, false, true);
service.setConnectorServices(new sailpoint.connector.DefaultConnectorServices());
service.checkForErrors(false);
RpcRequest request = new RpcRequest("ScriptExecutor", "runAfterScript", data);
RpcResponse response = service.execute(request);
return response;
And this is the Powershell scipt/rule
Add-type -path C:\Sailpoint\IQService\Utils.dll
$sReader = New-Object System.IO.StringReader([System.String]$env:Request);
$xmlReader = [System.xml.XmlTextReader]([sailpoint.Utils.xml.XmlUtil]::getReader($sReader));
$requestObject = New-Object Sailpoint.Utils.objects.AccountRequest($xmlReader);
$resultObject = New-Object Sailpoint.Utils.objects.ServiceResult;
$attributes = @{}
foreach ($attribute in $requestObject.AttributeRequests){
$attributes[$attribute.Name] = $attribute.Value;
}
$resultObject.Messages.add("Some value");
Am I missing something? What the above code does is send over the “fake” Account Request. I take the value from the request (targetUser) and then pass that to the Powershell script to get some data about the user. The goal is to send back one attribute (like lastlogondate, for example) to IIQ. That’s not in the Powershell code - I’m still trying to get the script to pass data back to IIQ. Thoughts?