CreateAccountJSON in WINPS connector

Sanket
New Contributor II
New Contributor II

Hi Team,

We are using below CREATEACCOUNTJSON in our WINPS connector but we are getting erro while doing provisioning.

{"CREATEACC":["script=\$pw = convertto-securestring '${PSSCRIPT_PASSWORD}' -asplaintext -force;\$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'Administrator',\$pw;Invoke-Command -ComputerName '<ComputerName>' -Credential \$mycred -ScriptBlock {New-ADUser -SamAccountName '${user.systemUserName}' -Enabled \$True -AccountPassword (ConvertTo-SecureString -AsPlainText '${randomPassword}' -Force) -PassThru}"],"SuccessResponses" : {"OBJECTTOREAD":"get(0).PSShowComputerName","SUCCESSVALUE":"True"}}

We have formed this JSON after referring the freshdesk documentation (even that JSON is having parsing error).

Can anyone guide us for forming this JSON?

Thanks!

Sanket Bhandhari 

1 REPLY 1

ParitaSavla
Saviynt Employee
Saviynt Employee

Can you please try with the below JSON

{
"CREATEACC": "{\"script\":\"\\$pw = convertto-securestring \\\"${PSSCRIPT_PASSWORD}\\\" -asplaintext -force; \\$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist \\\"Administrator\\\",\\$pw;Invoke-Command -ComputerName '<ComputerName>' -Credential \\$mycred -ScriptBlock {New-ADUser -SamAccountName \\\"${user.systemUserName}\\\" -Enabled \\$True -AccountPassword (ConvertTo-SecureString -AsPlainText \\\"${randomPassword}\\\" -Force) -PassThru}\"}",
"SuccessResponses": {
"OBJECTTOREAD": "get(0).PSShowComputerName",
"SUCCESSVALUE": "True"
}
}