Skip to content

Instantly share code, notes, and snippets.

@XPlantefeve
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XPlantefeve/a4dec212b48ecb2f7079 to your computer and use it in GitHub Desktop.
Save XPlantefeve/a4dec212b48ecb2f7079 to your computer and use it in GitHub Desktop.
Gets a computer to boot on PXE at next boot, clears the flag, or retrieve the information. For Dell systems with the Sysman WMI layer installed.
<#
Gets a computer to boot on PXE at next boot, clears the flag,
or retrieve the information.
Works for Dell systems with the Sysman WMI layer installed.
LAST UPDATED: 18/02/2015
AUTHOR : Xavier Plantefève
#>
$BIOSPwd = 'My BIOS Password'
Function Set-PXEBoot {
Param( [string]$ComputerName = '.' )
(Get-WmiObject -Class DCIM_BIOSService -Namespace root/dcim/sysman `
-ComputerName $ComputerName).SetBIOSAttributes($null,$null,'Force PXE on Next Boot','2',$Global:BIOSPwd)
}
Function Clear-PXEBoot {
Param( [string]$ComputerName = '.' )
(Get-WmiObject -Class DCIM_BIOSService -Namespace root/dcim/sysman `
-ComputerName $ComputerName).SetBIOSAttributes($null,$null,'Force PXE on Next Boot','1',$Global:BIOSPwd)
}
Function Get-PXEBoot {
Param( [string]$ComputerName = '.' )
$PXENextBoot = (Get-WmiObject -Class DCIM_BIOSEnumeration -Namespace root/dcim/sysman `
-ComputerName $ComputerName | where { $_.InstanceID -like '*/BiosSetupPXENextBoot' }).CurrentValue
Switch ($PXENextBoot) {
(1) { $PXENextBoot = $false }
(2) { $PXENextBoot = $true }
}
$PXENextBoot
}
New-Alias -Name setpxe -Value "Set-PXEBoot" -Scope Global
New-Alias -Name resetpxe -Value "Clear-PXEBoot" -Scope Global
New-Alias -Name getpxe -Value "Get-PXEBoot" -Scope Global
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment