Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

WINPS Connector: Error in CreateAccount task

jdoma
Regular Contributor
Regular Contributor

Hello Forum,

We are using WINPS connector to integrate Exchange with Saviynt. The CreateAccount task is failing with error as below but we can see that the powershell script executed successfully and able to see the account in Exchange. And we are not able to see any account under Users in Saviynt.

'ERROR services.WindowsConnectorService - Error occured while creating account -JagadeeshD\n","stream":"stdout"'

We do not have any entitlements under Exchange endpoint.

CreateAcc JSON:

{
"CREATEACC":["Script=Invoke-Command -ComputerName 'localhost' -FilePath <<file path of the script>> -argumentlist <no.of arguments as input parameters>;"],
"SuccessResponses" : ["Objectreturned"]
}

We have tried below as well but still same issue.

"SuccessResponses" : {"OBJECTTOREAD":"get(0).PSShowComputerName","SUCCESSVALUE":"True"}}

Any leads would be much appreciated.

8 REPLIES 8

RakeshMG
Saviynt Employee
Saviynt Employee

Please try using following json:

{"CREATEACC":[
"script=$pw = convertto-securestring '${PSSCRIPT_PASSWORD}' -asplaintext -force;$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'XXXXX\\XXXX',$pw;Invoke-Command -ComputerName 'XXXXXX' -Credential $mycred -ScriptBlock {C:\\XXXX\\XXXX.ps1}"],"SuccessResponses" : ["Successful"]}

 

For more details please refer to following document :

https://docs.saviyntcloud.com/bundle/WinPS-v2020x/page/Content/Understanding_the_Integration-between... 

CREATEACCOUNTJSON


​Regards

Rakesh M Goudar

jdoma
Regular Contributor
Regular Contributor

Hi Rakesh, thank you for your response.

We have tried with below setting but no luck.

"SuccessResponses" : ["Successful"]}

jdoma
Regular Contributor
Regular Contributor

I have tried with this but still the task is not getting auto completed. 
"SuccessResponses" : ["Success","success","SUCCESS","0", "true","True","TRUE"]}

What will be the response from WINPS connector to confirm that the request is successful.

adriencosson
Regular Contributor III
Regular Contributor III

Hi @jdoma,

Usually, when PS Script runs successfully, it does not provide any response.

Hence the response provided by the connector usually starts with "No result returned".

If you do not expect results too for successful response, you can try below JSON : 

{"CREATEACC":["Script=ExecuteMyScript.ps1"],"SuccessResponses" : "No results returned"}

Note : if you retrieve any different message from your script, the task won't get completed as PS Script returns a message.

Hope this helps !

Regards,
Adrien COSSON

jdoma
Regular Contributor
Regular Contributor

Hi Adrien,

Thank you, its moving the request to Completed List but how do we handle if any error occurs while webservice call. We are trying to place powershell script with in Saviynt connection jsons. I have tired to use try-catch blocks but its not allowing under script block. Any suggestions will be appreciated.

adriencosson
Regular Contributor III
Regular Contributor III

Hello @jdoma,

You can use Try / Catch Powershell script in Saviynt JSONs.

Below is an example built on Create Account that checks if account already exists on target AD. If Yes, it will enable the account. Otherwise it will create a new one.

Hope this helps !

Regards,
Adrien COSSON

jdoma
Regular Contributor
Regular Contributor

Thanks for the sample json, it was a great help. And if any exception occurs during the script execution, will that be printed in Saviynt logs. If not, how can we print a proper error message with in Saviynt logs.

adriencosson
Regular Contributor III
Regular Contributor III

Hello @jdoma,

Exceptions raised during your PS Script will be for sure caught in Saviynt logs.

Regards,
Adrien COSSON