bios-cli

Usage

  • bios-cli.ps1 [-help] [<CommonParameters>]

  • bios-cli.ps1 [-import] <filename> [ [-format] <string>] [ [-currentpassword] <string>] [ [-nosummary]] [ [-nowarnings]] [<CommonParameters>] [-target <hostname>]

  • bios-cli.ps1 [-export] <filename> [ [-format] <string>] [<CommonParameters>] [-target <hostname>]

  • bios-cli.ps1 [-get] <settingname> [ [-format] <string>] [<CommonParameters>] [-target <hostname>]

  • bios-cli.ps1 [-reset] [ [-currentpassword] <string>] [<CommonParameters>] [-target <hostname>]

  • bios-cli.ps1 [-password] [ [-set] <string>] [-clear] [-check] [ [-currentpassword] <string>] [<CommonParameters>] [-target <hostname>]

  • bios-cli.ps1 [-set] <string> [-value] <string> [ [-currentpassword] <string>] [<CommonParameters>] [-target <hostname>]

Description

This script is a user-facing command line interface for manipulating HPBIOS settings. It can be used to set, read, or reset BIOS settings.

The script supports input and output formats in XML, JSON, CSV, and also in the legacy Bios Configuration Utility (BCU) format. Normally the file format is inferred from the extension of the file, but can also be dictated via the -format parameter.

Arguments

-import <filename>

format: \<-import> <filename> [-format <csv|bcu|json|xml>] [-nosummary] [-nowarnings] [-currentpassword \<password>]

Import one or more settings from a file. Normally the format of the file is inferred from the file extension, but can be overriden with the -format parameter.

Specify -nosummary to turn off the end-import one-line summary. By default, -nosummary is false.

Specify -nowarnings to turn off any warnings about settings that are not found. By default, -nowarnings is false.

If a setup password is active on the system, it must be specified via the -currentpassword switch.

-export <filename>

format: <-export> <filename> [-format <csv|bcu|json|xml>]

Export one or more settings to a file. Normally the format of the file is inferred from the file extension, but can be overriden with the -format parameter. Password settings are not exported.

-help

format: <-help>

Print the command line usage.

-get <settingname>

format: <-get> <settingname> [-format <csv|bcu|json|xml>]

Get a single setting from the BIOS. By default, the only setting's value is returned.

Optionally, the -format string may be provided to retrieve a full setting definition, and format it as a bcu, xml, json, or csv entry.

-reset

format: <-reset> [-currentpassword <password>]

Reset all settings to factory defaults. The result of this operation may be platform specific.

If a setup password is active on the system, it must be specified via the -currentpassword switch.

-password <string>

format: <-password> <-set |-check | -clear> [-currentpassword <password>]

Manipulates the setup password.

Specify -set <password> to set the password, -check to check if the password is set, and -clear to clear the password.

To modify the password while a password is already set, the existing password must be supplied via the -currentpassword argument.

-set <string>

format: <-set> <setting> [-value] <newvalue> [-currentpassword <password>]

Set a single bios setting. Specify the value with the -value switch If a BIOS setup passwod is currently active on the machine, the password must be supplied via the -currentpassword switch

-target <hostname>

execute command on specified computer (applies to most commands)

Notes

Where passwords are required, they may be specified as a single dash (-). This will cause the script to promt the user for the password. Use this when passing passwords via the command line is inappropriate.

Examples

Example 1 - Setting BIOS Settings

PS C:\> bios-cli.ps1 -set "Asset Tracking Number" -value "My Tag"

Example 2 - Getting a BIOS setting

PS C:\> bios-cli.ps1 -get "Asset Tracking Number" -format json

Example 3 - Exporting all settings

PS C:\> bios-cli.ps1 -export test.txt -format bcu

Example 4 - Importing settings

PS C:\> bios-cli.ps1 -import test.txt -nowarnings -nosummary -format bcu

# The following version is identical to previous version, but prompts for password

PS C:\> bios-cli.ps1 -import test.json -currentpassword -

Example 5 - Resetting settings

PS C:\> bios-cli.ps1 -reset

Example 6 - Manipulate BIOS password

PS C:\> bios-cli -password -check

# Clear current password

PS C:\> bios-cli -password -clear -currentpassword oldpassword

# or to prompt for password...

PS C:\> bios-cli -password -clear -currentpassword -

# set / change password

PS C:\> bios-cli -password -set newpassword -currentpassword oldpassword

# or to prompt for both password...

PS C:\>  bios-cli -password -set -  -currentpassword -