Files
PowerCLI-Example-Scripts/Scripts/Get-BiosBootStatus.ps1
dmilov fb641c8a1c License PowerCLI-Examples-Scripts repository under BSD-2 Clause (#462)
As part of the VMware open source program, we have to update this repository with the correct license and copyright information.
We add the BSD-2 Clause License for this repository.
We mark all source code provided by VMware with the Copyright notice under BSD-2 Clause license.

* Update repository license to BSD 2-Clause License

* Update Copyright
2021-06-07 09:58:47 +03:00

46 lines
1.4 KiB
PowerShell

<#
Copyright 2021 VMware, Inc.
SPDX-License-Identifier: BSD-2-Clause
#>
function Get-BiosBootStatus {
<#
.NOTES
===========================================================================
Created by: Brian Graf
Organization: VMware
Official Blog: blogs.vmware.com/PowerCLI
Personal Blog: www.vtagion.com
Twitter: @vBrianGraf
===========================================================================
.DESCRIPTION
This will return the boot status of Virtual Machines, whether they
are booting to the Guest OS or being forced to boot into BIOS.
.Example
# Returns all VMs and where they are booting
Get-BiosBootStatus -VMs (Get-VM)
.Example
# Only returns VMs that are booting to BIOS
Get-BiosBootStatus (Get-VM) -IsSetup
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$true,
ValueFromPipeline=$True,
Position=0)]
[VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl[]]
$VM,
[switch]$IsSetup
)
Process {
if($IsSetup)
{
$Execute = $VM | where {$_.ExtensionData.Config.BootOptions.EnterBiosSetup -eq "true"} | Select Name,@{Name="EnterBiosSetup";Expression={$_.ExtensionData.config.BootOptions.EnterBiosSetup}}
}
else
{
$Execute = $VM | Select Name,@{Name="EnterBiosSetup";Expression={$_.ExtensionData.config.BootOptions.EnterBiosSetup}}
}
}
End {$Execute}
}