Changing Lenovo Bios Settings with PS

Hello everyone

A little story before I ask for help.

—Story–
I work in a community college. I’ve been in the IT industry for over 15 years. In these 15+ years I had it in my head that I hate programming because of my experience with it in College. Recently, I accidentally installed 8GB sticks in 4 of 35 computers in a lab. I noticed this only after all the RAM was installed. I was angry at the fact that I would have to crack open all the computers to visually check every one of them. I rant to my colleague about it. He says give me 5 minutes. Sure enough 5 minutes later he tells me, it’s in the following 4 computers. MAGIC!

Thus begins my , marvelous? journey into the world of programming. I decided to start with Powershell, wish me luck :slight_smile:

–end story–

As previously mentioned, I am a technologist working in a community college. We recently purchased a whole bunch of Lenovo ThinkCentre M710s. In the BIOS there is an option to have the computer power on or off at certain times. I don’t feel like logging into each computer to change this and was hoping that I can use Powershell to enable these settings. We were previously purchasing Dell PCs and they had a program that with the help of SCCM we were able to automate changing the BIOS settings. I cannot find any software like this for our Lenovo machines. Therefore I figured I would try and make my own.

So far to prepare myself I watched Getting Started with Microsoft PowerShell with Jason Helmick and Jeffrey Snover. After finishing that I even felt adventurous enough to watch Advanced Tools & Scripting with PowerShell 3.0 , again with the same duo.

So now I am here to take advantage of this helpful PS community. I have a few questions for everyone.

EDIT
I found this Lenovo BIOS Windows Management Instrumentation Interface Deployment Guide for Desktop

I am currently reading this guide. I erased my original questions and I will post any future questions as a reply if I get stuck. In the meantime I am open to any suggestions on how to best handle this problem.

Thank you all in advance. I look forward to learn with you guys by my side :slight_smile:

Some Lenovo machines appear have a CIM classes in the root\wmi namespace

You can view them with
Get-CimClass -Namespace root/WMI -ClassName l*

First thing is to check they are present. I found
Lenovo_BIOSElement
Lenovo_SetBiosSetting
Lenovo_DiscardBiosSettings
Lenovo_BiosSetting
Lenovo_SaveBiosSettings
Lenovo_SetBiosPassword
Lenovo_BiosPasswordSettings
Lenovo_LoadDefaultSettings

If they are present
Get-CimInstance -Namespace root/WMI -ClassName Lenovo_BiosSetting

will show you the actual bios settings. You need to use Lenovo_SetBiosSetting to make the changes

For learning more about PowerShell and WMI I recommend PowerShell and WMI PowerShell and WMI I t has a lot of examples on performing admin actions with WMI as well as explaining how WMI works.

My day’s not been too bad apart from the fact its been raining so I couldn’t get out to complete my 1200 miles in 2017 challenge

Thank you for your response Richard.

I wish you guys could see how many tabs I have open in my browser right now. I feel like the scene where Bambi is learning to walk. I am currently reading up on WMIs. I’ve heard about them and have a very very… VERY limited understanding on them right now :stuck_out_tongue: I found this nice little blog about WMIs. I thought I would share for anyone else that might browse this thread and benefit from my findings.

I appreciate your explanations! I am here to learn and not have you guys just write the script for me. I’m going to look at your response a bit longer, read some more on WMIs and I will give you an update if I get stuck. As of right now I’ve been provided with enough guidance to hopefully resolve this issue.

Again, thank you for your time!

My lenovo bios .bat script looks like this:

cfgwin /r /path:mysettings.txt /admin:mypass,ascii,us

edit figured out my connection issue

JS

Could you explain your script to me? What I am guessing is that you went into the BIOS of a Lenovo machine. Setup everything the way you wanted. Ran the lenovo_biossetting and out-filed it to a .txt You then apply that .txt which are all the settings you want to a list of other computers?

Here’s where I am at.

I read up on WMI and CIM repositories until my head hurt. I now managed to query a remote system and output the result into a txt file so that I could read the current settings. I then logged onto that computer, changed the settings manually to what I would want and ran my script again and saved it to a different .txt so that I could compare the two.

So here’s the result I got.
Unconfigured bios
Active : True
CurrentSetting : Alarm Time(HH:MM:SS),[00:00:00][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_73
PSComputerName : 4135-01

Active : True
CurrentSetting : Alarm Date(MM/DD/YYYY),[01/01/2016][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_74
PSComputerName : 4135-01

Active : True
CurrentSetting : Alarm Day of Week,Sunday;[Optional:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_75
PSComputerName : 4135-01

Active : True
CurrentSetting : Sunday,Disabled;[Optional:Disabled,Enabled][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_76
PSComputerName : 4135-01

Here’s the configured BIOS (I setup the computer to use a wake up alarm at 3am on Sundays on a weekly basis)

Active : True
CurrentSetting : Alarm Time(HH:MM:SS),[00:00:00][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_73
PSComputerName : 4135-01

Active : True
CurrentSetting : Alarm Date(MM/DD/YYYY),[01/01/2016][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_74
PSComputerName : 4135-01

Active : True
CurrentSetting : Alarm Day of Week,Sunday;[Optional:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_75
PSComputerName : 4135-01

Active : True
CurrentSetting : Sunday,Disabled;[Optional:Disabled,Enabled][Status:ShowOnly]
InstanceName : ACPI\PNP0C14\1_76
PSComputerName : 4135-01

I am reading the Lenovo Guide and I know I have to use Lenovo_SetBiosSetting to set it but I can’t figure out the syntax. I piped Lenovo_SetBiosSetting to GM and got some results. It listed Methods and Properties. However, I can’t figure out how to say “set the following settings”

I’m closer than I was before though and feeling encouraged.

Thanks for the help guys.

Marc were you able to figure out how to change boot order of your machines? if so is there anyway you could help me out. I am in a similar scenario that you were in

I am closer. With the Christmas break this kinda got put on hold. It isn’t an urgent issue for me either so it kinda got put on the back burner.

Are you in a hurry to get this resolved? If not I can work with you to get it going…

We also just got off Christmas break so we are just starting to work on it in our free time again.

This is the code that I have started with today

$pcnames = Import-Csv pcnames.csv
foreach ($name in $pcnames){
(gwmi -class Lenovo_SetBiosSetting -namespace root\wmi).SetBiosSetting(‘Primary Boot Sequence,Hard Drive:Network Card:USB Key;[Exclude from boot order:USB Hard Disk:USB CD/DVD:Floppy Drive: USB Floppy:CD/DVD Drive]’)
}

Marc,
I know its bit pricey but well worth it but I started getting into powershell using Don Jones course on CBT nuggets. The site is pricey but the man is the God of teachers. You will without a doubt learn a lot from him. Its also around 90 videos. Out of all of the ways of learning powershell, I found his methods of teaching to be amazing. HIGHLY RECOMMENDED!
Good luck with your endeavors!