02/08/2023 12:57 AM
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
02/08/2023 03:49 PM
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"
}
}