IQService powershell script error with import-clixml : the system cannot find the path specified

Hello developer community

I have a powershell script running with an afterCreate rule like here : IdentityNow Rule Guide - After Creation Rule - Compass
And I am using Import-Clixml to import my credentials such as :

$Credential=Import-Clixml C:/SailPoint/scripts/Credential/Credential.xml

I have this error : the system cannot find the path specified
whereas my path is the good one.
image

Here is how I generate my credentials in the SetCredential.ps1 :

$pwd = ConvertTo-SecureString "*************" -AsPlainText -Force

$Credential = New-Object System.Management.Automation.PSCredential("test-INT\test", $pwd)

$Credential | Export-Clixml ./Credential.xml

Thanks in advance for you tips

Hi @JosquinClv

Can you please try

$Credential=Import-Clixml -Path "C:/SailPoint/scripts/Credential/Credential.xml"
or 
$Credential=Import-Clixml "C:/SailPoint/scripts/Credential/Credential.xml"

Hello Rajesh,

Thanks for your answer, I tried both ways but still get the same error.
I tried Get-Content -Path C:/SailPoint/scripts/Credential/Credential.xml to check if I could access it and I can access the content of the file but not used it as credentials afterwards.

I found this

in the following link

Please try and share the outcome

Hey Josquin,

We have seen an issue like this before. Can you confirm that the account used to create the credentials is also the account running the script? If you are intending for a service account to run this script, make sure that the script is set to run as that service account. When you are generating these credential files, run Powershell as the service account and use that instance to generate the files.

In our situation, we didn’t generate the credential files with the service account so it was causing this error for us.

Thank you,

  • Zach

Hello Nithesh,

I tried this but I didn’t let create account afterwards ( timeout error)

Hello Zach,

Thanks for you answer, it did the trick ! I had to generate my credentials throught my rule to have indeed the same account that generating the credentials and running the script.

Hey @JosquinClv ,

Great to hear, glad it worked for you! If you wouldn’t mind, can you please mark my answer as the solution to this thread if it solved your issue? This helps those of us answering threads and it helps future users identify the solution if they are encountering the same issue.

Thank you,

  • Zach

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