Usage

PSRUN can issue API calls directly or by using short commands.

Usage

psrun2 [options] host key user method endpoint [payload]
psrun2 [options] host key user short-command [payload]

Parameters

  • Host: The BeyondInsight host.
  • Key: The API registration key.
  • User: The BeyondInsight user that is granted permission to use the API key.
    • If using a domain account, escape it with a backslash (for example, domain\\user).
    • If BeyondInsight requires a user password, append it to the value (for example, "user;pwd=[my-password]").
  • Method: The API action, must be one of GET, PUT, POST, or DELETE.
  • Endpoint: An API endpoint (for example, Assets, Credentials, Imports, etc.).
  • Payload: The request body, specified in key=value format if calling the API directly, or as a list of values if using short commands.

Options

PSRUN behavior can be controlled by options, which must be specified before the address parameter:

-v Verbose, logs all communication as well as the factors sent to the server.
-sf Skips factors if they are not required for authentication.
-i Allows insecure communication when the server certificate cannot be verified.

-quote

Wrap column output in double quotes.

-separator <separator> Delimit column output (default is TAB).
-noheaders Hides column names in the output.
-filter Shows only specified columns.
-cert "path" Specifies the path to the client certificate file.
-certpass "password" Specifies the password for the certificate file.
-e "command" Executes a system command instead of displaying result .
--help Display this usage and short command help.

Error Code

PSRUN returns an error code of 0 for success, or 1 for failure.

psrun2 -quote -separator "," address …
psrun2 -filter "SystemId,SystemName,AccountId,AccountName" … ListAccounts
psrun2 -cert CertificateFileName address …
psrun2 -cert "CertificateFileName" -certpass "CertificatePassword" address …
psrun2 -e "echo '[Password]'" address RetrievePassword …
psrun2 … POST UserGroups/1/Permissions [ PermissionID=1 AccessLevelID=1 PermissionID=1 AccessLevelID=2 ]
psrun2 $(cat params.txt) ListSystems

For more details, please see the BeyondInsight and Password Safe API Guide.