Skip to content

Commit

Permalink
Fix for Issues #10 and #11 (#17)
Browse files Browse the repository at this point in the history
- Fixed issue which caused xBLAutoBitlocker to incorrectly detect Fixed vs Removable volumes (issue #11).
- Fixed issue which made xBLAutoBitlocker unable to encrypt volumes with drive letters assigned (issue #10).
  • Loading branch information
MartinVokurek authored and johlju committed Jun 5, 2018
1 parent 3a48bcf commit 609e54d
Show file tree
Hide file tree
Showing 3 changed files with 401 additions and 7 deletions.
38 changes: 33 additions & 5 deletions DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function Get-TargetResource
$UsedSpaceOnly
)

#Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0
#Load helper module
Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0

CheckForPreReqs

Expand Down Expand Up @@ -151,8 +152,9 @@ function Set-TargetResource
[System.Boolean]
$UsedSpaceOnly
)

#Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0

#Load helper module
Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0

CheckForPreReqs

Expand Down Expand Up @@ -254,7 +256,8 @@ function Test-TargetResource
$UsedSpaceOnly
)

#Load helper module Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0
#Load helper module
Import-Module "$((Get-Item -LiteralPath "$($PSScriptRoot)").Parent.Parent.FullName)\Misc\xBitlockerCommon.psm1" -Verbose:0

CheckForPreReqs

Expand Down Expand Up @@ -372,10 +375,35 @@ function GetAutoBitlockerStatus
{
[Hashtable]$returnValue = @{}

# Convert DriveType into values returned by Win32_EncryptableVolume.VolumeType
switch ($DriveType)
{
'Fixed'
{
$driveTypeValue = 1
}
'Removable'
{
$driveTypeValue = 2
}
}

foreach ($blv in $allBlvs)
{
$vol = $null
$vol = Get-Volume -Path $blv.MountPoint -ErrorAction SilentlyContinue | where {$_.DriveType -like $DriveType}

$encryptableVolumes = Get-CimInstance -Namespace 'root\cimv2\security\microsoftvolumeencryption' -Class Win32_Encryptablevolume -ErrorAction SilentlyContinue

if (Split-Path -Path $blv.MountPoint -IsAbsolute)
{
# MountPoint is a Drive Letter
$vol = $encryptableVolumes | Where-Object {($_.DriveLetter -eq $blv.Mountpoint) -and ($_.VolumeType -eq $driveTypeValue)}
}
else
{
# MountPoint is a path
$vol = $encryptableVolumes | Where-Object {($_.DeviceID -eq $blv.Mountpoint) -and ($_.VolumeType -eq $driveTypeValue)}
}

if ($vol -ne $null)
{
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ It does not work on Operating System drives.
**xBLAutoBitlocker** has the following properties.
Where no description is listed, properties correspond directly to [Enable-Bitlocker](http://technet.microsoft.com/en-us/library/jj649837.aspx) parameters.

* *DriveType:The type of volume, as reported by Get-Volume, to auto apply Bitlocker to
* *DriveType:The type of volume to auto apply Bitlocker to. Valid values are "Fixed" or "Removable"
* *PrimaryProtector:The primary protector type to be used for AutoBitlocker.
Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector"
* MinDiskCapacityGB:If specified, only disks this size or greater will auto apply Bitlocker
Expand Down Expand Up @@ -132,7 +132,8 @@ Defaults to false.
* Added `PowerShellVersion = '4.0'`, and updated copyright information, in the
module manifest.
* Fixed issue which caused Test to incorrectly succeed on fully decrypted volumes when correct Key Protectors were present ([issue #13](https://github.com/PowerShell/xBitlocker/issues/13))

* Fixed issue which caused xBLAutoBitlocker to incorrectly detect Fixed vs Removable volumes. ([issue #11](https://github.com/PowerShell/xBitlocker/issues/11))
* Fixed issue which made xBLAutoBitlocker unable to encrypt volumes with drive letters assigned. ([issue #10](https://github.com/PowerShell/xBitlocker/issues/10))

### 1.1.0.0

Expand Down
Loading

0 comments on commit 609e54d

Please sign in to comment.