From a4399b935659b55ad9babcfbb7268ffc899e97b9 Mon Sep 17 00:00:00 2001 From: Martin Vokurek Date: Wed, 23 May 2018 23:21:31 +0200 Subject: [PATCH] Fix for issue #10 AutoBitLocker should handle volumes with drive letter assigned now --- .../MSFT_xBLAutoBitlocker.psm1 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 b/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 index 74a1d6b..1eac79b 100644 --- a/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 +++ b/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 @@ -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 @@ -152,7 +153,8 @@ function Set-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 @@ -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 @@ -375,7 +378,11 @@ function GetAutoBitlockerStatus foreach ($blv in $allBlvs) { $vol = $null - $vol = Get-Volume -Path $blv.MountPoint -ErrorAction SilentlyContinue | where {$_.DriveType -like $DriveType} + if ($blv.MountPoint -like "?:") { + $vol = Get-Volume -DriveLetter ($blv.MountPoint).TrimEnd(":") -ErrorAction SilentlyContinue | Where-Object {$_.DriveType -like $DriveType} + } else { + $vol = Get-Volume -Path $blv.MountPoint -ErrorAction SilentlyContinue | Where-Object {$_.DriveType -like $DriveType} + } if ($vol -ne $null) {