-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLenovo BIOS Settings - Powershell Demo.ps1
More file actions
45 lines (31 loc) · 2.02 KB
/
Lenovo BIOS Settings - Powershell Demo.ps1
File metadata and controls
45 lines (31 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# https://webcache.googleusercontent.com/search?q=cache:9uQZl9nYyqgJ:https://www.configjon.com/lenovo-bios-settings-management/+&cd=3&hl=en&ct=clnk&gl=us
#Connect to the Lenovo_BiosSetting WMI class
$SettingList = Get-WmiObject -Namespace root\wmi -Class Lenovo_BiosSetting
#Return a list of all configurable settings
#$SettingList | Select-Object CurrentSetting
#Return a specific setting and value
$GetSetting = $SettingList | Where-Object CurrentSetting -Like "LockBIOSSetting*" | Select-Object -ExpandProperty CurrentSetting
if ($GetSetting -eq "LockBIOSSetting,Enable")
{
Write-Host "Installed"
}
# =============================
# The second WMI class is Lenovo_SetBiosSetting. This class contains a method called SetBiosSetting which is used to modify bios setting values.
#Connect to the Lenovo_SetBiosSetting WMI class`
$Interface = Get-WmiObject -Namespace root\wmi -Class Lenovo_SetBiosSetting
# Set a specific BIOS setting when a BIOS password is not set
#$Interface.SetBiosSetting("LockBIOSSetting,Enabled")
# Set a specific BIOS setting when a BIOS password is set
$Interface.SetBiosSetting("LockBIOSSetting,Enable,ITSC671,ascii,us")
# The third WMI class is Lenovo_SaveBiosSetting. This class contains a method called SaveBiosSettings which is used to commit any changes made to BIOS setting values.
#Connect to the Lenovo_SaveBiosSetting WMI class
$SaveSettings = Get-WmiObject -Namespace root\wmi -Class Lenovo_SaveBiosSettings
#Save any outstanding BIOS configuration changes (no password set)
# $SaveSettings.SaveBiosSettings()
#Save any outstanding BIOS configuration changes (password set)
$SaveSettings.SaveBiosSettings("ITSC671,ascii,us")
# The fourth WMI class is Lenovo_BiosPasswordSettings. This class is used to query the current status of the BIOS passwords.
#Connect to the Lenovo_BiosPasswordSettings WMI class
#$PasswordSettings = Get-WmiObject -Namespace root\wmi -Class Lenovo_BiosPasswordSettings
#Check the current password configuration state
# $PasswordSettings.PasswordState