# Load Token issue in Powershell script

**URL:** <https://developer.sailpoint.com/discuss/t/load-token-issue-in-powershell-script/123506>\
**Category:** SHF Discussion and Questions\
**Tags:** powershell-sdk, sailpoint-identity-security\
**Created:** [April 30, 2025, 11:07pm UTC](https://developer.sailpoint.com/discuss/t/load-token-issue-in-powershell-script/123506 "2025-04-30T23:07:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harishassuredpartners](https://avatars.discourse-cdn.com/v4/letter/h/6a8cbe/32.png) [@harishassuredpartners](https://developer.sailpoint.com/discuss/u/harishassuredpartners)\
**Post date:** [April 30, 2025, 11:07pm UTC](https://developer.sailpoint.com/discuss/t/load-token-issue-in-powershell-script/123506/1 "2025-04-30T23:07:14Z")

</div>

Hi There,

I am not able to load token from my powershell script. I have encrypted the secret using securestring. Seeing following error in powershell script logs “(04-30-2025 13:31:47) [ERROR] Failed to obtain identity: Exception calling “.ctor” with “2” argument(s): “Cannot process argument because the value of argument “password” is null. Change the value of argument “password” to a non-null value.”  
(04-30-2025 13:31:47) [ERROR] Failed to obtain identity. Terminating after script before actions taken.”

Error in IQ Trace logs – “04/30/2025 12:52:37 : RpcHandler [Thread-5] ERROR : “Malformed request received from client - ::ffff:168.63.129.16:61164. Received header length as - Error in parsing - Input string was not in a correct format.”

This is my Load token function - function Load-Token () {  
# This method is used to load the environment variables for the SailPoint SDK.  
# ConvertFrom-SecureString -SecureString $(Read-Host -AsSecureString)

```
$env:SAIL_BASE_URL="https://$SAILPOINT_TENANT.api.identitynow.com"
$env:SAIL_CLIENT_ID=$SAILPOINT_CLIENT_ID
    
$credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $SAILPOINT_CLIENT_ID, ($SAILPOINT_ENCRYPTED_CLIENT_SECRET | ConvertTo-SecureString) 
$env:SAIL_CLIENT_SECRET=$credentials.GetNetworkCredential().password

```

}  
Could someone help me on this?

---

<div class="post-metadata">

**Author:** ![JackSparrow](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jacksparrow/32/19685_2.png) [@JackSparrow](https://developer.sailpoint.com/discuss/u/JackSparrow)\
**Post date:** [May 1, 2025, 8:30am UTC](https://developer.sailpoint.com/discuss/t/load-token-issue-in-powershell-script/123506/2 "2025-05-01T08:30:29Z")

</div>

I think you need to convert Client secret from secure string to plain text.

```auto
$ClientSecret = Convert-SecureStringToPlainText -secureString $SecureClientSecret

```

---

<div class="post-metadata">

**Author:** ![harishassuredpartners](https://avatars.discourse-cdn.com/v4/letter/h/6a8cbe/32.png) [@harishassuredpartners](https://developer.sailpoint.com/discuss/u/harishassuredpartners)\
**Post date:** [May 6, 2025, 4:30pm UTC](https://developer.sailpoint.com/discuss/t/load-token-issue-in-powershell-script/123506/3 "2025-05-06T16:30:28Z")

</div>

This is resolved - Password needs to be encrypted with the service account.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [July 5, 2025, 4:31pm UTC](https://developer.sailpoint.com/discuss/t/load-token-issue-in-powershell-script/123506/4 "2025-07-05T16:31:08Z")

</div>

Closed on July 5, 2025, 4:31pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
