List and change BIOS settings with PowerShell


In this post I will show you how to list and change BIOS settings for HP, Dell and Lenovo with PowerShell only.

In my previous posts, I did some tools and module to list, export and change BIOS settings for local and remote computers and many manufacturers.
I will now show you how to manage BIOS settings with PowerShell only:
- List settings
- Change settings without BIOS password 
- Change settings with BIOS password configured 
- Change settings from a CSV file that contains settings to change

I say only, because there are some tools available to manage BIOS with PowerShell. For instance for HP, there is a utility called BCU.
As I don't want any other tools to manage BIOS I just used PowerShell.

List BIOS Settings

For HP
To get BIOS settings the WMI query to use is the below one:
You can get for instance settings name, current value and also available values, as below:
# settings name, current value and also available values In my tool and modules I used the below function:

For DELL
A module is available to list BIOS settings, 
To use it and list name, current value, available values you can use the function below:
To list specific values proceed as below:

For LENOVO
To get BIOS settings the WMI query to sue is the below one:
You can get for instance settings name, current value and also available values, as below:
In my tool and modules I used the below function:


Change BIOS settings

For HP
The first step will be to check if a BIOS password is configured.
For that use the below query:
To change settings without BIOS password proceed as below:
To change settings with a BIOS password proceed as below:
To change a list of settings for instance from a CSV file.
To check if settings have been correctly changed, proceed as below:
See below return code and here the full doc.

My CSV contain all setings to change an new values, as below:

For LENOVO
The first step will be to check if a BIOS password is configured.
For that use the below query:
To change settings without BIOS password proceed as below:
To change settings with a BIOS password proceed as below:
To change a list of settings for instance from a CSV file.
To check if settings have been correctly changed, proceed as below:

See below return code and here the full doc.

For DELL
The first step will be to check if a BIOS password is configured.
For that use the below query:
To change a Dell BIOS setting you have to know what is the category of the setting you want to change.
To resume the category is the part where is located your setting, for instance which Tab.
For example, settings FnLock and NumLock are located in the Category POSTBehavior.
To set it proceed as below:
To change settings without BIOS password proceed as below:
To change settings with a BIOS password proceed as below:
To change a list of settings for instance from a CSV file.
My CSV contain all setings to change an nexw values, as below.

BIOS checker: Export / Compare local and remote BIOS settings


In this post, I will show you a tool I created that allows you to export BIOS configurations from local or remote computer(s) to a CSV or HTML report. 
It also allows you to compare both configurations and do an HTML or Excel comparison report.


How to get the tool ?



How it looks like ?
The tool is composed of two parts 
- Export BIOS
- Compare BIOS

The export BIOS part looks like as below:

For now three manufacturers are available. I will add more.
- Dell
- HP
- Lenovo

A button in the title bar allows you to set credentials to get remote computers configuration
The compare BIOS part looks like as below:

Another theme is available, a Dark Theme, as below:
To use it, change the XAML to launch at line 30.

Note: Depending of the language of your computer, the Excel report may be displayed in one column instead of one per part. You can use Excel to change that :-)


Export Part

Export local BIOS configuration
1 / Choose your manufacturer
2 / Choose the folder where your export will be saved
3 / Choose the export format
- HTML
- CSV, XLSX
4 / In the export type part, choose local computer
5 / Click on the Export BIOS button
6 / Once the process starts the GUI will be hidden until the end.
If you have selected CSV, your report will look like as below:

If you have selected HTML, your report will look like as below:

Export one remote BIOS configuration
1 / Click in the title bar button
2 / Type credentials to access to the remote computer
3 / Choose your manufacturer
4 / Choose the folder where your export will be saved
5 / Choose the export format
- HTML
- CSV, XLSX
6 / In the export type choose remote computer
7 / In the target part, choose one computer
8 / Type the remote computer name in the TextBox
9 / Click on the Export BIOS button
10 / Once the process starts the GUI will be hidden until the end.

Export multiple remote BIOS configuration
1 / Click in the title bar button
2 / Type credentials to access to the remote computer
3 / Choose your manufacturer
4 / Choose the folder where your export will be saved
5 / Choose the export format
- HTML
- CSV, XLSX
6 / In the export type choose remote
7 / In the target part, choose multiple computers
8 / In the computer list part, click on the button an choose the list of computers to manage. All computers should be located in a TXT file.
9 / Click on the Export BIOS button
10 / Once the process starts the GUI will be hidden until the end.


Compare Part
1 / Choose the export format of the report
- HTML
- XLSX
2 / Choose the folder where your export will be saved
3 / Choose the both CSV files to compare
4 / Click on the compare button
If you have selected CSV, your report will look like as below:

If you have selected HTML, your report will look like as below:


Create cool dialog or message box with PowerShell and WPF


In this post, I will an easy way to display cool messagebox or dialogs with PowerShell and WPF.

How to get samples ?


What is it ?
The library I will talk about it is called SimpleDialog.
It has been created by Maurício Vielmo Schmaedeck who did a really nice job.
You can find the GitHub repo here.

How it looks like ?
The library is composed of 6 dialogs.
- Information
- Success 
- Warning
- Error
- Critical error
- Progress

Where to find it ?
You can find the library on this GitHub repo.

How to install it ?
1 / Create a folder assembly
2 / Create a folder resources
In this step I guess you already have a ps1 and XAML files. If not you can find them in the download link.
My project will look like as below:
3 / Download the Nuget.exe file. You can find it here.
4 / Copy the nuget.exe in your project folder.
5 / Now we will download the required dll to play with the library
6 / Use the below command to download it.
7 / The DLL file will be available in the folder SimpleDialogs.1.0.3\lib\net45
Note that the version may change.
8 / Copy the SimpleDialogs.dll file to the assembly folder previously created
Now we have everything we need, let us see how to implement it.

How to implement it ?

XAML part
1 / Copy the below lines in the Window part.
2 / See below my Window part after
3 / Add the below Resources part after the Window part.
4 / See below my full XAML file.

PS1 part
1 / Add the below line, at the beginning of your script, to load the assembly
2 / Your dialog will be displayed after clicking on a button.
We will now see how to use it.

How to use it ?
The simpleDialog is composed of 6 dialogs which are divised in two classes AlertDialog and ProgressDialog.

The dialogs below will be used in the class [SimpleDialogs.Controls.AlertDialog]
- Information
- Success 
- Warning
- Error
- Critical error

The Progress dialog will be used using the class [SimpleDialogs.Controls.ProgressDialog]
Use the below part to create and display your Alert Dialog
Use the below part to create and display your Progress Dialog
To choose what kind of dialog to display you have to play with the AlertLevel property.
See below which AlertLevel to use depending of the Dialog
- Information: information
- Success: Success 
- Warning: warning
- Error: error
- Critical error: critical

See below how to use it:
To change title and message of your Dialog use the below properties:
See below how to use it:
By default Dialogs will look like as below:


Customize the Dialog
There are several properties available to customize the main design of the design like colors, buttons...
To customize it, use the below properties (I don't use all of them in this sample)
For instance if you want to change the main color of a Dialog use the property Foreground.
You can also choose what kind of button to display in your Dialog. For instance you can choose to dislay a Yes and No button or also choose to display a Copy to clipbard button. This one will copy text content in the clipboard.
In the below GUI, I added some properties to customize to change the design of my Dialogs.

See below all properties available for the AlertDialog
See below all properties available for the ProgressDialog

Create your own MDT FinishAction


In this post, I will show a quick tip that allows you to create your own finish action, in order to execute a specific action after clicking on the Finish button or at the end of the deployment.

Context
In MDT a variable called FinishAction allows you to do a specific action when deployment is finished. 
This action is done once you click on the Finish button or when the deployment is finished.
By default there are three actions available:
- Reboot or restart
- Logoff
- Shutdown
So why not creating a new one ?

What do I want ? 
Once the deployment is completed, I want to run the below actions:
- Create a folder C:\OSD_Logs
- Copy deployment logs in C:\OSD_Logs
- Copy DISM, panther ligs in C:\OSD_Logs\System
- Create system and applications evtx and copy them in OSD_Logs
- Reboot the computer
See below the PowerShell script I will use to do that. I named it SD_Reboot_Actions.ps1 and copied it in Scripts folder.

What to modify ?
1 / Open the file Litetouch.wsf
2 / Search the part Sub Reboot, by default as below:
3 / Copy it and rename it as, Sub Reboot_Custom, as below:
4 / Then call the PowerShell script in the Reboot_Custom as below:
5 / Now we have to choose a value for our custom FinishAction. This way we can call it from the customsettings.ini file or TS.
6 / In Litetouch.wsf search "Select Case UCase(sFinishAction)", by default as below:
7 / Choose a value to use, in my case MY_REBOOT and call your custom reboot action, as below:
8 / Now to use this new FinishAction, you will need to use it with the new created value for instance in the customsettings.ini, FinishAction=MY_REBOOT or in a Task Sequence step.