i’m trying to invoke a ps1 script using Invoke-PSUScript, the steps leading to having a secured credential being passed are correct but for some reason - it always comes back to me with an error found below. anyone has encountered this? i’d appreciate the help.
Cannot convert the “System.Management.Automation.PSCredential” value of type “System.Management.Automation.PSCredential” to type “PowerShellUniversal.Variable”
Is -Credential a parameter in your script that you are trying to call? If so, we currently don’t support passing credentials with Invoke-PSUScript. We do have an open issue for this. Additionally, you would need to rename it because it conflicts with the built-in runas support credential parameter.
If you’re trying to use the built-in runas credential parameter, then you will need to define a variable and reference that.
Invoke-PSUScript is expecting a variable and not a credential. The variable should be defined in the secret store and PSU will look it up from there.
For example, you would have to create a secret variable.
And then when you run the script, use the variable name rather than the secret directly.
i get it - correct me if i’m wrong - now it got me thinking, i can call multiple ps1’s using different elevated accounts (without changing the runas account and set to default) but i just have to create multiple stored creds needed per ps1, right? like the ones below…
although i know i’m in the right direction but i get that error above. i have the DB settings unchanged, i set the variable under PSUSecretStore - so i have the ps1 stored under the DB’s folder and also in the scripts folder