Skip to content

Commit c368660

Browse files
authored
Merge pull request #35 from mhendric/AddRemainingAutoBitlockerTests2
MSFT_xBLAutoBitlocker: Add remaining Unit Tests for xBLAutoBitlocker
2 parents c84931f + 4132ab3 commit c368660

File tree

3 files changed

+341
-194
lines changed

3 files changed

+341
-194
lines changed

DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function Set-TargetResource
200200

201201
if ($null -eq $autoBlVols)
202202
{
203-
throw "No Auto Bitlocker volumes were found"
203+
throw 'No Auto Bitlocker volumes were found'
204204
}
205205
else
206206
{
@@ -320,9 +320,13 @@ function Test-TargetResource
320320

321321
$autoBlVols = GetAutoBitlockerStatus @PSBoundParameters
322322

323+
$allEnabled = $true
324+
323325
if ($null -eq $autoBlVols)
324326
{
325-
return $false
327+
Write-Error -Message 'Failed to retrieve Bitlocker status'
328+
329+
$allEnabled = $false
326330
}
327331
else
328332
{
@@ -338,12 +342,14 @@ function Test-TargetResource
338342

339343
if ($testResult -eq $false)
340344
{
341-
return $testResult
345+
Write-Verbose -Message "Volume with Key '$key' is not yet enabled for Bitlocker"
346+
347+
$allEnabled = $false
342348
}
343349
}
344350
}
345351

346-
return $true
352+
return $allEnabled
347353
}
348354

349355
function GetAutoBitlockerStatus
@@ -437,7 +443,7 @@ function GetAutoBitlockerStatus
437443
)
438444

439445
#First get all Bitlocker Volumes of type Data
440-
$allBlvs = Get-BitLockerVolume | Where-Object -FilterScript {$_.VolumeType -eq "Data"}
446+
$allBlvs = Get-BitLockerVolume | Where-Object -FilterScript {$_.VolumeType -eq 'Data'}
441447

442448
#Filter on size if it was specified
443449
if ($PSBoundParameters.ContainsKey("MinDiskCapacityGB"))

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Defaults to false.
127127
originally encrypted and AutoUnlock was not used.
128128
* Add remaining Unit Tests for xBitlockerCommon.
129129
* Add Unit tests for MSFT_xBLTpm
130+
* Add remaining Unit Tests for xBLAutoBitlocker
130131

131132
### 1.2.0.0
132133

0 commit comments

Comments
 (0)