Product: PowerShell Universal
Version: 2026.1.3
Hi everyone,
First of all, let me disclose tht I’m far from being an expert on PSU since I have only started working with it in a test environment recently, neither am I a professional programmer - I’m a hobbyist at best.
I’ve been prototyping a PSU-based solution to replace an old internal system and I’ve been experimenting with PSU Variables and Secrets.
To sum-up what I’m trying to do:
Our users need to log into to various Web services with generic accounts (ex: one account per geographical site on each service) but naturally, we don’t want to share the credentials openly with everyone who needs access.
For this, they have an SSO-based intranet dashboard that calls web automation scripts (which I’m also working on converting from an older technology to Playwright).
I managed, by script, to export and import Secrets into PSU in the PSCredential format and when I try to retrieve them individually, everything works no problem.
However, the way I wanted to do things was to have one script per service, which would then fetch the right set of credentials based on the user’s geographical site and potnetially other variables.
That’s where my issue arises:
Our Secret variables are named following a structure like say ServiceName_GeoSiteName
So if I construct the variable by doing
$SecretName = $ServiceName+“_”+$UserGeoSite
I cannot seem to find a way to use $SecretName to call the Secret with
$Secret:$SecretName
Unexpected token ‘$SecretName’ in expression or statement.
I’ve tried fiddling around whith brackets, parenthesis, moving the $ sign about but I cannot figure a way to dynamically refer to a Secret.
Is there a way to call a Secret like this where the name of the Secret is not known prior to user interaction?
Am I going at it wrong / is my logic flawed?
Thank you for your help!


