Using Secret Fields in Scripts
Secret Server supports using PowerShell, SSH, and SQL scripts as dependencies on a secret. These scripts can use information on the secret through the field name prepended with a $. For example, $DOMAIN, $PASSWORD, or $USERNAME. Linked secrets are accessible by $[1]$FIELDNAME for the first linked secret, $[2]$FIELDNAME for the second, and so on. Note that the password tokens are context-sensitive: $PASSWORD, $CURRENTPASSWORD, $NEWPASSWORD and $PRIORPASSWORD resolve to different values depending on the script type and where in the password-change lifecycle it runs.
There are two contexts in which script dependencies run:
- As part of the RPC process. See Creating RPC Scripts.
- When run manually from the Dependencies tab on the secret.
For a complete list of tokens that are available to script dependencies, see Dependency Token List.
For tokens available in RPC, heartbeat, and other scripting contexts, see Complete Scripting Token Reference.