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.
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.
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.
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.