Configuring the blpowershell.cnf file


This topic explains the purpose of the blpowershell.cnf file, describes the available options, and details how to configure it. This topic includes the following sections:

About the blpowershell.cnf file

When the RSCD agent starts for the first time, it creates a blpowershell.cnf configuration file with the default values as mentioned in the following table. This file is present in the share directory in the RSCD installation directory on the target servers. RSCD Agent recognizes the PowerShell script based on the extension (.ps1) and these scripts are executed using the configured values in blpowershell.cnf file. When RSCD Agent starts, it checks if the configuration file exists or not. If the file doesn't exist, it is created with default values.

Note

Ensure that you are using 8.9.04 or later version of the RSCD Agent.

The PowerShell configuration file has predefined values, as described in the following table:

The following code sample provides an example of a default blpowershell.cnf configuration file on Windows environment:

PS_STATE=Enabled
PS_CMD=powershell.exe
PS_ARGS=-NoLogo -inputformat NONE -NonInteractive
PS_POLICY=-ExecutionPolicy RemoteSigned
PS_SCRIPT_TYPE=-File


To manage PowerShell configurations

A new NSH remote command (blpowershell) is provided to manage the PowerShell default configurations. This command can be executed through a NSH Type 1 script job. The following table lists the options of the command:

The following code sample provides an example:

AppServerHost% cd //Win-Host
Win-Host% blpowershell -help
blpowershell: Command to manage configurations stored in blpowershell.cnf file.
Usage:
blpowershell -enable <enable powershell feature>
blpowershell -disable <disable powershell feature>
blpowershell -setoption "option" "value" <set "option" to "value" in configuration file>
blpowershell -getoption "option" <retrieves configured value of "option" from configuration file>
blpowershell -getoption <retrieves all the configured values from configuration file>
blpowershell -resetoption <reset all option to default values in configuration file>
blpowershell -removeoption "option" <remove "option" from configuration file>
blpowershell -help <print this usage message>
Win-Host% blpowershell -getoption
PS_STATE=Enabled
PS_CMD=powershell.exe
PS_ARGS=-NoLogo -inputformat NONE -NonInteractive
PS_POLICY=-ExecutionPolicy RemoteSigned
PS_SCRIPT_TYPE=-File
Win-Host% blpowershell -getoption PS_ARGS
-NoLogo -inputformat NONE -NonInteractive
Win-Host% blpowershell -setoption PS_ARGS "-inputformat TEXT -NonInteractive"
Win-Host% blpowershell -getoption PS_ARGS
-inputformat TEXT -NonInteractive
Win-Host%

To override PowerShell configurations at runtime

The default PowerShell options are configured in the blpowershell.cnf file. These PowerShell options are used when creating the final PowerShell command line.

However, you can also use additional PowerShell options at runtime when executing the PowerShell script. When you use these options along with the script, these are used in creating the final PowerShell command line, and these options are then passed to the PowerShell script.

For example, when a sample.ps1 script is executed against a target Windows server where default powershell options are present, the final powershell command is created as: 

powershell.exe -NoLogo -inputformat NONE -NonInteractive -ExecutionPolicy RemoteSigned -File sample.ps1

The following table lists the available options which can be used to override the configured PowerShell options at runtime. The Example column shows the final PowerShell command formed when the specified overriding option is used.

You can also use a combination of one or more options. The following code sample provides an example when you are using blpsignoreargs and blpsaddargs options in a PowerShell script file named sample.ps1:

Option used: -blpsignoreargs  -blpsaddargs "-WindowStyle Minimized"
Final command: powershell.exe -WindowStyle Minimized -ExecutionPolicy RemoteSigned -File sample.ps1

For more information about how to pass the overriding options at runtime in NSH Type 3 script by using command line, see Executing-PowerShell-scripts-on-target-servers.

Videos

The following video (6:28) provides an overview of how to manage the blpowershell.cnf file.

icon-play.pnghttps://youtu.be/Uqe5bym3jjk

The following videos provide an overview of how to override the PowerShell configurations at runtime.

Related topics

Executing-PowerShell-scripts-on-target-servers

FAQs and additional resources

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*