Skip to content

Instantly share code, notes, and snippets.

@SMSAgentSoftware
Created May 9, 2022 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SMSAgentSoftware/20db23ae652feb8dfc9b1bca7addf9ba to your computer and use it in GitHub Desktop.
Save SMSAgentSoftware/20db23ae652feb8dfc9b1bca7addf9ba to your computer and use it in GitHub Desktop.
Pulls some of the BIOS settings for an HP workstation
$SetupPasswordIsSet = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSPassword -Filter "Name='Setup Password'" -ErrorAction SilentlyContinue | Select -ExpandProperty IsSet
$PowerOnPasswordIsSet = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSPassword -Filter "Name='Power-On Password'" -ErrorAction SilentlyContinue | Select -ExpandProperty IsSet
$SecureBoot = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Secure Boot'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$LANWLANAutoSwitching = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='LAN / WLAN Auto Switching'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$ThunderboltSecurityLevel = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Thunderbolt Security Level'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$RestrictUSBDevices = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Restrict USB Devices'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$RequirePWChangeThunderboltSL = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Require BIOS PW to change TBT SL'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$HostBasedMACAddress = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Host Based MAC Address'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$CapsuleUpdateAdminPrompt = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Prompt for Admin authentication on Capsule Update'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$LockBIOSVersion = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Lock BIOS Version'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$NativeOSFWUpdateService = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Native OS Firmware Update Service'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$BIOSRollbackPolicy = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='BIOS Rollback Policy'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$BIOSAutoUpdate = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Automatic BIOS Update Setting'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$ConfigureLegacyAndSecureBoot = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSEnumeration -Filter "Name='Configure Legacy Support and Secure Boot'" -ErrorAction SilentlyContinue | Select -ExpandProperty CurrentValue
$BornOnDate = Get-CimInstance -Namespace ROOT\HP\InstrumentedBIOS -ClassName HP_BIOSSetting -Filter "Name='Born On Date'" -ErrorAction SilentlyContinue | Select -ExpandProperty Value
$HPBIOSSettings = [ordered]@{
SetupPasswordIsSet = $null
PowerOnPasswordIsSet = $null
SecureBoot = $null
ConfigureLegacyAndSecureBoot = $null
ThunderboltSecurityLevel = $null
RequirePWChangeThunderboltSL = $null
BIOSAutoUpdate = $null
BIOSRollbackPolicy = $null
LockBIOSVersion = $null
CapsuleUpdateAdminPrompt = $null
NativeOSFWUpdateService = $null
LANWLANAutoSwitching = $null
RestrictUSBDevices = $null
HostBasedMACAddress = $null
BornOnDate = $null
}
$HPBIOSSettings.SetupPasswordIsSet = $SetupPasswordIsSet
$HPBIOSSettings.PowerOnPasswordIsSet = $PowerOnPasswordIsSet
$HPBIOSSettings.SecureBoot = $SecureBoot
$HPBIOSSettings.ConfigureLegacyAndSecureBoot = $ConfigureLegacyAndSecureBoot
$HPBIOSSettings.ThunderboltSecurityLevel = $ThunderboltSecurityLevel
$HPBIOSSettings.RequirePWChangeThunderboltSL = $RequirePWChangeThunderboltSL
$HPBIOSSettings.BIOSAutoUpdate = $BIOSAutoUpdate
$HPBIOSSettings.BIOSRollbackPolicy = $BIOSRollbackPolicy
$HPBIOSSettings.LockBIOSVersion = $LockBIOSVersion
$HPBIOSSettings.CapsuleUpdateAdminPrompt = $CapsuleUpdateAdminPrompt
$HPBIOSSettings.NativeOSFWUpdateService = $NativeOSFWUpdateService
$HPBIOSSettings.LANWLANAutoSwitching = $LANWLANAutoSwitching
$HPBIOSSettings.RestrictUSBDevices = $RestrictUSBDevices
$HPBIOSSettings.HostBasedMACAddress = $HostBasedMACAddress
If ($null -ne $BornOnDate)
{
$HPBIOSSettings.BornOnDate = [datetime]::ParseExact($BornOnDate,"MM/dd/yyyy",[CultureInfo]::InvariantCulture) | Get-Date -Format "s"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment