cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

Script Username & Password Variable

Hello,

I am writing a script (VBS) to use in SAM.  It will execute on the Orion server with the default Orion credentials, but I am running Oracle queries within the script that require a separate username & password.  I do not want to store the username & password explicitly within the script, instead I would like to use the Orion variables to pull the username & password from the SAM credentials list.  Is there any way to do this?

0 Kudos
4 Replies
Product Manager
Product Manager

You can use the ${USER}, and ${PASSWORD} macros within your script to pass the username and password specified in the component settings.

@aLTeReGo 

When I am using the ${USER} and ${PASSWORD} variables in a PowerShell script monitor the ${USER} returnds the value, but the ${PASSWORD} variable does not.

Is there something I am missing for this?

To validate, I am running this basic test.  The user name is returned, but the password is blank.

Write-Host "User is: " ${USER}
Write-Host "Password is: " ${PASSWORD}

0 Kudos

The following Macros are available to script monitors. If the password macro is not working, I would recommend testing with a password that does not contain any special characters. It's possible the password contains a character that is preventing it from being handled properly. It also appears that you may be testing this exclusively using the 'test' method. Not all macros are processed until they are actually assigned to a specific endpoint. I would recommend testing by writing to a file. E.G. [Set-Content -Path 'C:\file.txt' -Value '${USER}, ${PASSWORD}']

  • ${USER}
  • ${PASSWORD}
  • ${PORT}
  • ${Node.SysName}
  • ${Node.Caption}
  • ${Node.DNS}
  • ${Node.ID}
  • ${Component.ID}
  • ${Component.Name}
  • ${Application.Id}
  • ${Application.Name}
  • ${Application.TemplateId
  • ${Threshold.Warning}
  • ${Threshold.Critical}
  • Node Custom Property Macros ${Node.CustomPropertyName}
  • Application Custom Property Macros ${Application.CustomPropertyName}
0 Kudos

I deployed the PowerShell script monitor with line of code you suggested and it still only writes the username to the file and not the password.

0 Kudos