We are not able to process the JavaScript from ServiceNow, which is working well when we execute directly in MID Server.We have tried with a sample PowerShell script from ServiceNowwhich is working as expected so, we have converted the whole function from Java Script toPowerShell script and tried to execute which isnt working as expected. Please find the code below which we tried and let us know if it required any changes.$util = (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/dchest/tweetnacl-js/master/nacl-fast.js') [raw.githubusercontent.com] | Out-Null$key = "sGdZ7v57K6cMAd6gIb7IeJfQDmN561YDtSkMNxnykCU="$passPhrase = "VenafiNous123!"function encrypt($data, $key){ $encodedData = [Text.Encoding]::UTF8.GetBytes($data) $decodedKey = [Convert]::FromBase64String($key) $encryptedData = [nacl.sealedbox]::Create($encodedData, $decodedKey) return [Convert]::ToBase64String($encryptedData)}$encryptedKey = encrypt $passPhrase $keyWrite-Output $encryptedKey.