Skip to content

Commit

Permalink
Merge pull request #46 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 1.4.0.0 of xBitlocker
  • Loading branch information
kwirkykat authored Jan 9, 2019
2 parents 2facc14 + ebb676e commit af3361e
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 161 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Unreleased

## 1.4.0.0

- Change double quoted string literals to single quotes
- Add spaces between array members
- Add spaces between variable types and variable names
- Add spaces between comment hashtag and comments
- Explicitly removed extra hidden files from release package

## 1.3.0.0

- Update appveyor.yml to use the default template.
Expand Down
58 changes: 29 additions & 29 deletions DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Get-TargetResource
param
(
[Parameter(Mandatory = $true)]
[ValidateSet("Fixed","Removable")]
[ValidateSet('Fixed', 'Removable')]
[System.String]
$DriveType,

Expand All @@ -96,7 +96,7 @@ function Get-TargetResource
$MinDiskCapacityGB,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -113,7 +113,7 @@ function Get-TargetResource
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -170,7 +170,7 @@ function Get-TargetResource
$UsedSpaceOnly
)

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

Assert-HasPrereqsForBitlocker
Expand Down Expand Up @@ -270,7 +270,7 @@ function Set-TargetResource
param
(
[Parameter(Mandatory = $true)]
[ValidateSet("Fixed","Removable")]
[ValidateSet('Fixed', 'Removable')]
[System.String]
$DriveType,

Expand All @@ -279,7 +279,7 @@ function Set-TargetResource
$MinDiskCapacityGB,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -296,7 +296,7 @@ function Set-TargetResource
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -353,7 +353,7 @@ function Set-TargetResource
$UsedSpaceOnly
)

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

Assert-HasPrereqsForBitlocker
Expand All @@ -366,13 +366,13 @@ function Set-TargetResource
}
else
{
Remove-FromPSBoundParametersUsingHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "DriveType","MinDiskCapacityGB"
Add-ToPSBoundParametersFromHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"MountPoint" = ""}
Remove-FromPSBoundParametersUsingHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DriveType', 'MinDiskCapacityGB'
Add-ToPSBoundParametersFromHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{'MountPoint' = ''}

#Loop through each potential AutoBitlocker volume, see whether they are enabled for Bitlocker, and if not, enable it
# Loop through each potential AutoBitlocker volume, see whether they are enabled for Bitlocker, and if not, enable it
foreach ($key in $autoBlVols.Keys)
{
$PSBoundParameters["MountPoint"] = $key
$PSBoundParameters['MountPoint'] = $key

$testResult = Test-BitlockerEnabled @PSBoundParameters

Expand Down Expand Up @@ -474,7 +474,7 @@ function Test-TargetResource
param
(
[Parameter(Mandatory = $true)]
[ValidateSet("Fixed","Removable")]
[ValidateSet('Fixed', 'Removable')]
[System.String]
$DriveType,

Expand All @@ -483,7 +483,7 @@ function Test-TargetResource
$MinDiskCapacityGB,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -500,7 +500,7 @@ function Test-TargetResource
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -557,7 +557,7 @@ function Test-TargetResource
$UsedSpaceOnly
)

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

Assert-HasPrereqsForBitlocker
Expand All @@ -574,13 +574,13 @@ function Test-TargetResource
}
else
{
Remove-FromPSBoundParametersUsingHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToRemove "DriveType","MinDiskCapacityGB"
Add-ToPSBoundParametersFromHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{"MountPoint" = ""}
Remove-FromPSBoundParametersUsingHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToRemove 'DriveType', 'MinDiskCapacityGB'
Add-ToPSBoundParametersFromHashtable -PSBoundParametersIn $PSBoundParameters -ParamsToAdd @{'MountPoint' = ''}

#Check whether any potential AutoBitlocker volume is not currently enabled for Bitlocker, or doesn't have the correct settings
# Check whether any potential AutoBitlocker volume is not currently enabled for Bitlocker, or doesn't have the correct settings
foreach ($key in $autoBlVols.Keys)
{
$PSBoundParameters["MountPoint"] = $key
$PSBoundParameters['MountPoint'] = $key

$testResult = Test-BitlockerEnabled @PSBoundParameters -VerbosePreference $VerbosePreference

Expand Down Expand Up @@ -684,7 +684,7 @@ function Get-AutoBitlockerStatus
param
(
[Parameter(Mandatory = $true)]
[ValidateSet("Fixed","Removable")]
[ValidateSet('Fixed', 'Removable')]
[System.String]
$DriveType,

Expand All @@ -693,7 +693,7 @@ function Get-AutoBitlockerStatus
$MinDiskCapacityGB,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -710,7 +710,7 @@ function Get-AutoBitlockerStatus
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -767,19 +767,19 @@ function Get-AutoBitlockerStatus
$UsedSpaceOnly
)

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

#Filter on size if it was specified
if ($PSBoundParameters.ContainsKey("MinDiskCapacityGB"))
# Filter on size if it was specified
if ($PSBoundParameters.ContainsKey('MinDiskCapacityGB'))
{
$allBlvs = $allBlvs | Where-Object -FilterScript {$_.CapacityGB -ge $MinDiskCapacityGB}
}

#Now find disks of the appropriate drive type, and add them to the collection
# Now find disks of the appropriate drive type, and add them to the collection
if ($null -ne $allBlvs)
{
[Hashtable]$returnValue = @{}
[Hashtable] $returnValue = @{}

# Convert DriveType into values returned by Win32_EncryptableVolume.VolumeType
switch ($DriveType)
Expand Down Expand Up @@ -813,7 +813,7 @@ function Get-AutoBitlockerStatus

if ($null -ne $vol)
{
[Hashtable]$props = @{
[Hashtable] $props = @{
VolumeStatus = $blv.VolumeStatus
KeyProtectors = $blv.KeyProtector
EncryptionMethod = $blv.EncryptionMethod
Expand Down
18 changes: 9 additions & 9 deletions DSCResources/MSFT_xBLBitlocker/MSFT_xBLBitlocker.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Get-TargetResource
$MountPoint,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -108,7 +108,7 @@ function Get-TargetResource
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -165,7 +165,7 @@ function Get-TargetResource
$UsedSpaceOnly
)

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

Assert-HasPrereqsForBitlocker
Expand Down Expand Up @@ -265,7 +265,7 @@ function Set-TargetResource
$MountPoint,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -286,7 +286,7 @@ function Set-TargetResource
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -343,7 +343,7 @@ function Set-TargetResource
$UsedSpaceOnly
)

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

Assert-HasPrereqsForBitlocker
Expand Down Expand Up @@ -441,7 +441,7 @@ function Test-TargetResource
$MountPoint,

[Parameter(Mandatory = $true)]
[ValidateSet("PasswordProtector","RecoveryPasswordProtector","StartupKeyProtector","TpmProtector")]
[ValidateSet('PasswordProtector', 'RecoveryPasswordProtector', 'StartupKeyProtector', 'TpmProtector')]
[System.String]
$PrimaryProtector,

Expand All @@ -462,7 +462,7 @@ function Test-TargetResource
$AutoUnlock = $false,

[Parameter()]
[ValidateSet("Aes128","Aes256")]
[ValidateSet('Aes128', 'Aes256')]
[System.String]
$EncryptionMethod,

Expand Down Expand Up @@ -519,7 +519,7 @@ function Test-TargetResource
$UsedSpaceOnly
)

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

Assert-HasPrereqsForBitlocker
Expand Down
6 changes: 3 additions & 3 deletions DSCResources/MSFT_xBLTpm/MSFT_xBLTpm.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Get-TargetResource
$AllowImmediateReboot = $false
)

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

Assert-HasPrereqsForBitlocker
Expand Down Expand Up @@ -109,7 +109,7 @@ function Set-TargetResource
$AllowImmediateReboot = $false
)

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

Assert-HasPrereqsForBitlocker
Expand Down Expand Up @@ -185,7 +185,7 @@ function Test-TargetResource
$AllowImmediateReboot = $false
)

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

Assert-HasPrereqsForBitlocker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Configuration ConfigureBitlockerAndAutoBitlocker
{
Import-DscResource ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName xBitlocker

Node 'E15-1'
Node 'localhost'
{
#First install the required Bitlocker features
# First install the required Bitlocker features
WindowsFeature BitlockerFeature
{
Name = 'Bitlocker'
Expand All @@ -20,7 +20,7 @@ Configuration ConfigureBitlockerAndAutoBitlocker
IncludeAllSubFeature = $true
}

#This example enables Bitlocker on the Operating System drive using both a RecoveryPasswordProtector and a StartupKeyProtector
# This example enables Bitlocker on the Operating System drive using both a RecoveryPasswordProtector and a StartupKeyProtector
xBLBitlocker Bitlocker
{
MountPoint = 'C:'
Expand All @@ -31,22 +31,20 @@ Configuration ConfigureBitlockerAndAutoBitlocker
AllowImmediateReboot = $true
UsedSpaceOnly = $true

DependsOn = '[WindowsFeature]BitlockerFeature','[WindowsFeature]BitlockerToolsFeature'
DependsOn = '[WindowsFeature]BitlockerFeature', '[WindowsFeature]BitlockerToolsFeature'
}

#This example sets up AutoBitlocker for any drive of type Fixed with a RecoveryPasswordProtector only.
# This example sets up AutoBitlocker for any drive of type Fixed with a RecoveryPasswordProtector only.
xBLAutoBitlocker AutoBitlocker
{
DriveType = 'Fixed'
PrimaryProtector = 'RecoveryPasswordProtector'
RecoveryPasswordProtector = $true
UsedSpaceOnly = $true

DependsOn = '[xBLBitlocker]Bitlocker' #Don't enable AutoBL until the OS drive has been encrypted
# Don't enable AutoBL until the OS drive has been encrypted
DependsOn = '[xBLBitlocker]Bitlocker'
}
}
}

ConfigureBitlockerAndAutoBitlocker

#Start-DscConfiguration -Verbose -Wait -Path .\ConfigureBitlockerAndAutoBitlocker -ComputerName "E15-1"
Loading

0 comments on commit af3361e

Please sign in to comment.