Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Syntax error - WinPS Connector

dchaudhary1
New Contributor III
New Contributor III

Hi Team,

I have copied the same code from https://docs.saviyntcloud.com/bundle/WinPS-v2021x/page/Content/Best-Practices-for-Configuring-PowerS... :

{

 "CREATEACC":[

     "script=\$pw = convertto-securestring '${PSSCRIPT_PASSWORD}' -asplaintext -force;\$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'XXXXX',\$pw;Invoke-Command -ComputerName 'XXXXX' -Credential \$mycred -ScriptBlock {C:/Users/chaudharyd/Win-PSScript.ps1  -accountName "XXXX"}"

 ],

 "SuccessResponses":{

     "OBJECTTOREAD":"get(0).PSShowComputerName",

     "SUCCESSVALUE":"True"

 }

}

Following exception have been observed :

org.codehaus.groovy.grails.web.converters.exceptions.ConverterException: Error parsing JSON at grails.converters.JSON.parse(JSON.java:292) at com.saviynt.ecm.services.WindowsConnectorService.fetchCommand(WindowsConnectorService.groovy:1275) at com.saviynt.ecm.services.WindowsConnectorService$_createAccount_closure17.doCall(WindowsConnectorService.groovy:839) at com.saviynt.ecm.services.WindowsConnectorService.createAccount(WindowsConnectorService.groovy:802) at com.saviynt.ecm.services.ArsTaskService.createAccountTarget(ArsTaskService.groovy:11673) at com.saviynt.ecm.services.ArsTaskHelperService$_whenTaskTypeIsThreeNewAccountAccess_closure50.doCall(ArsTaskHelperService.groovy:3061) at com.saviynt.ecm.services.ArsTaskHelperService.whenTaskTypeIsThreeNewAccountAccess(ArsTaskHelperService.groovy:3052) at com.saviynt.ecm.services.ArsTaskHelperService$_completeAutoProvTasksUpgraded_closure1.doCall(ArsTaskHelperService.groovy:172) at com.saviynt.ecm.services.ArsTaskHelperService.completeAutoProvTasksUpgraded(ArsTaskHelperService.groovy:157) at MultipleProvisioningJob.execute(MultipleProvisioningJob.groovy:222) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)Caused by: org.codehaus.groovy.grails.web.json.JSONException: Expected a ',' or ']' at character 435 of {

1 REPLY 1

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @dchaudhary1,

Could you please try use to below json,

{

 "CREATEACC":[

     "script=\$pw = convertto-securestring '${PSSCRIPT_PASSWORD}' -asplaintext -force;\$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'XXXXX',\$pw;Invoke-Command -ComputerName 'XXXXX' -Credential \$mycred -ScriptBlock {C:/Users/chaudharyd/Win-PSScript.ps1  -accountName \"XXXX\"}"

 ],

 "SuccessResponses":{

     "OBJECTTOREAD":"get(0).PSShowComputerName",

     "SUCCESSVALUE":"True"

 }

}

Thanks

If you find the above response useful, Kindly Mark it as "Accept As Solution".