Skip to content

Commit

Permalink
Corrected Get-WindowsOptionalFeature logic for client OS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Nothhard committed Jun 28, 2019
1 parent 1fb8d15 commit 1cf4da1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Misc/xBitlockerCommon.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -790,8 +790,8 @@ function Assert-HasPrereqsForBitlocker

if ((Get-OSEdition) -like 'Client')
{
$blFeature = Get-WindowsOptionalFeature BitLocker
if ($blFeature.InstallState -ne 'Installed')
$blFeature = Get-WindowsOptionalFeature -Online -FeatureName 'BitLocker'
if ($blFeature.State -ne 'Enabled')
{
$hasAllPreReqs = $false
Write-Error 'The Bitlocker feature needs to be installed before the xBitlocker module can be used'
Expand Down
4 changes: 3 additions & 1 deletion Tests/Unit/xBitlockerCommon.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -309,14 +309,16 @@ try
Mock -CommandName Get-WindowsOptionalFeature -MockWith {
param
(
[switch]
$online = $false,
[string]
$FeatureName
)

return @{
DisplayName = $FeatureName
Name = $FeatureName
InstallState = 'Installed'
State = 'Enabled'
}
}

Expand Down

0 comments on commit 1cf4da1

Please sign in to comment.