Click HERE to see how Saviynt Intelligence is transforming the industry. |
05/27/2024 01:35 AM
Hi All,
We are trying to execute below JSON, we are getting an error as "Operation not allowed as you are entering a value that resembles or contains script code"
JSON:
{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://XXXXXXXXXXX/Saviynt/PS/ExecutePSScript",
"httpMethod": "POST",
"httpParams": "{\"Script\": \"\\$pass = convertto-securestring -String '/xxxxxxx}l' -AsPlainText -Force;\\$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'twdev\\\\\\\\SA-Saviynt',\\$pass;\\$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://XXXXXXXXXXXXXXX/Powershell/' -Credential \\$mycred -Authentication Kerberos -AllowRedirection;Import-PSSession -Session \\$Session -DisableNameChecking -AllowClobber;\\$RemoteMailbox=Enable-RemoteMailbox -Identity '${user.email}' -RemoteRoutingAddress '${user.customproperty19}' -Alias ('${user.customproperty19}'.Split('@')[0]) -erroraction stop; if (\\$RemoteMailbox.PrimarySmtpAddress -ne '${user.email}') {Set-RemoteMailbox -Identity '${user.email}' -PrimarySmtpAddress '${user.email}' -EmailAddressPolicyEnabled \\$false; Set-RemoteMailbox -Identity '${user.email}' -EmailAddresses @{Remove='smtp:\\$(\\$RemoteMailbox.PrimarySmtpAddress)'}; Set-RemoteMailbox -Identity '${user.email}' ${if(null!=user.customproperty29 && !''.equals(user.customproperty29)){return '-EmailAddresses @{Add=\\'' + user.customproperty29 +'\\'}'} else{''}} \"}",
"httpHeaders": {
"Authorization": "Basic xxxxxxxxxxxxxxxxxx"
},
"httpContentType": "application/x-www-form-urlencoded",
"SuccessResponses": {
"": [
"Success"
]
},
"unsuccessResponses": {
"responseMessage": [
"\"Failed\"",
"\"Powershell script taking too long Sample input: Invoke-Command -ComputerName \\\"SAVIYNTADSVCS\\\" -ScriptBlock {command to execute} -Credential $Cred\""
]
}
}
]
}
05/27/2024 01:05 PM - edited 05/27/2024 01:06 PM
refer https://forums.saviynt.com/t5/tag/WINPS/tg-p