@@ -86,7 +86,7 @@ function EnableBitlocker
8686 {
8787 throw " A TpmProtector must be used if Pin is used."
8888 }
89-
89+
9090 if ($PSBoundParameters.ContainsKey (" AdAccountOrGroupProtector" ) -and $PrimaryProtector -notlike " AdAccountOrGroupProtector" -and ! (ContainsKeyProtector - Type " AdAccountOrGroup" - KeyProtectorCollection $blv.KeyProtector ))
9191 {
9292 Write-Verbose " Adding AdAccountOrGroupProtector"
@@ -164,7 +164,7 @@ function EnableBitlocker
164164 $handledTpmAlready = $true
165165
166166 $params.Add (" Pin" , $Pin.Password )
167-
167+
168168 if ($PSBoundParameters.ContainsKey (" StartupKeyProtector" ))
169169 {
170170 $params.Add (" TpmAndPinAndStartupKeyProtector" , $true )
@@ -181,7 +181,7 @@ function EnableBitlocker
181181 $handledTpmAlready = $true
182182
183183 $params.Add (" TpmAndStartupKeyProtector" , $true )
184- $params.Add (" StartupKeyPath" , $StartupKeyPath )
184+ $params.Add (" StartupKeyPath" , $StartupKeyPath )
185185 }
186186
187187
@@ -325,6 +325,11 @@ function TestBitlocker
325325 Write-Verbose " Unable to locate MountPoint: $ ( $MountPoint ) "
326326 return $false
327327 }
328+ elseif ($blv.VolumeStatus -eq " FullyDecrypted" )
329+ {
330+ Write-Verbose " MountPoint: $ ( $MountPoint ) Not Encrypted"
331+ return $false
332+ }
328333 elseif ($blv.KeyProtector -eq $null -or $blv.KeyProtector.Count -eq 0 )
329334 {
330335 Write-Verbose " No key protectors on MountPoint: $ ( $MountPoint ) "
@@ -352,7 +357,7 @@ function TestBitlocker
352357 if ($PSBoundParameters.ContainsKey (" Pin" ) -and ! (ContainsKeyProtector - Type " TpmPin" - KeyProtectorCollection $blv.KeyProtector - StartsWith $true ))
353358 {
354359 Write-Verbose " MountPoint '$ ( $MountPoint ) 'does not have TpmPin assigned."
355- return $false
360+ return $false
356361 }
357362
358363 if ($PSBoundParameters.ContainsKey (" RecoveryKeyProtector" ) -and ! (ContainsKeyProtector - Type " ExternalKey" - KeyProtectorCollection $blv.KeyProtector ))
@@ -383,7 +388,7 @@ function TestBitlocker
383388 {
384389 Write-Verbose " MountPoint '$ ( $MountPoint ) 'does not have TPM + StartupKey protector."
385390 return $false
386- }
391+ }
387392 }
388393 }
389394
@@ -397,7 +402,7 @@ function TestBitlocker
397402 return $true
398403}
399404
400- # Ensures that required Bitlocker prereqs are installed
405+ # Ensures that required Bitlocker prereqs are installed
401406function CheckForPreReqs
402407{
403408 $hasAllPreReqs = $true
@@ -420,7 +425,7 @@ function CheckForPreReqs
420425 Write-Error " The RSAT-Feature-Tools-BitLocker feature needs to be installed before the xBitlocker module can be used"
421426 }
422427
423- if ($blAdminToolsRemoteFeature.InstallState -ne " Installed" )
428+ if ($blAdminToolsRemoteFeature.InstallState -ne ' Installed' -and ( Get-OSEdition ) -notmatch ' Core ' )
424429 {
425430 $hasAllPreReqs = $false
426431
@@ -513,4 +518,14 @@ function RemoveParameters
513518 }
514519}
515520
521+ <#
522+ . SYNOPSIS
523+ Returns the OS edtion we currently running on
524+ #>
525+ function Get-OSEdition
526+ {
527+ (Get-ItemProperty - Path ' HKLM:/software/microsoft/windows nt/currentversion' - Name InstallationType).InstallationType
528+ }
529+
530+
516531Export-ModuleMember - Function *
0 commit comments