From 4aed734f4aa2158ca9fb82c674950299b86cf548 Mon Sep 17 00:00:00 2001 From: KarolKaczmarek Date: Tue, 2 Feb 2016 13:42:45 -0800 Subject: [PATCH 01/10] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4e73650..d482589 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,8 @@ Defaults to false. ### 1.1.0.0 +* Versioning updates + ### 1.0.1.1 * Reduced the number of acceptable values for PrimaryProtector in xBLAutoBitlocker and xBLBitlocker. From ba1d083ad8cf993bd241d95ec275201877ea5f36 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 22 Jun 2016 16:10:31 -0700 Subject: [PATCH 02/10] Added the new MS code of conduct --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d482589..d1b97bd 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ The **xBitlocker** module is a part of the Windows PowerShell Desired State Conf This module contains the **xBLAutoBitlocker, xBLBitlocker, xBLTpm** resources. This DSC Module allows you to configure Bitlocker on a single disk, configure a TPM chip, or automatically enable Bitlocker on multiple disks. +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. ## Contributing Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). From 9b6c5da1244f925d33291fafddc1dbfab2cb9628 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Tue, 5 Jul 2016 15:57:53 -0700 Subject: [PATCH 03/10] Removing os specification and chocolately from appveyor.yml. --- appveyor.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4b977c2..22fe6aa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,13 +2,12 @@ # environment configuration # #---------------------------------# version: 1.1.{build}.0 -install: - - cinst -y pester - - git clone https://github.com/PowerShell/DscResource.Tests - - ps: Push-Location - - cd DscResource.Tests - - ps: Import-Module .\TestHelper.psm1 -force - - ps: Pop-Location +install: + - git clone https://github.com/PowerShell/DscResource.Tests + - ps: | + Import-Module -Name .\DscResource.Tests\TestHelper.psm1 -Force + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-Module -Name Pester -Repository PSGallery -Force #---------------------------------# # build configuration # From 858bce2ff606656254ded5080e0b5effc6bb38cc Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Tue, 5 Jul 2016 15:58:27 -0700 Subject: [PATCH 04/10] Updating README. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d1b97bd..22248c2 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,8 @@ Defaults to false. ## Versions ### Unreleased +* Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. +* Updated appveyor.yml to use the default image. ### 1.1.0.0 From 9aea2bec8dd06f371a62446df5c56484238c591d Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Tue, 5 Jul 2016 16:31:27 -0700 Subject: [PATCH 05/10] Removing extra note from README. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 22248c2..61ba94a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xbitlocker/branch/master) +[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xbitlocker/branch/master) # xBitlocker The **xBitlocker** module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC Resources produced by the PowerShell Team. @@ -102,7 +102,6 @@ Defaults to false. ### Unreleased * Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. -* Updated appveyor.yml to use the default image. ### 1.1.0.0 From 9b00d76128c6762f253c3f7068250ad99183f0d3 Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Mon, 28 May 2018 09:34:56 +0200 Subject: [PATCH 06/10] Update resource module to standard (#15) - Changes to xBitlocker - Added Codecov support. - Updated appveyor.yml to use the one in template. - Added folders for future unit and integration tests. - Added Visual Studio Code formatting settings. - Added .gitignore file. - Added markdown lint rules. - Fixed encoding on README.md. - Added `PowerShellVersion = '4.0'`, and updated copyright information, in the module manifest. --- .codecov.yml | 24 ++++ .gitignore | 4 + .markdownlint.json | 10 ++ .vscode/settings.json | 13 ++ README.md | 131 +++++++++++------- .../integration_template.config.ps1 | 26 ++++ Tests/Integration/integration_template.ps1 | 87 ++++++++++++ Tests/Unit/unit_template.ps1 | 110 +++++++++++++++ appveyor.yml | 72 +++------- xBitlocker.psd1 | 16 +-- 10 files changed, 380 insertions(+), 113 deletions(-) create mode 100644 .codecov.yml create mode 100644 .gitignore create mode 100644 .markdownlint.json create mode 100644 .vscode/settings.json create mode 100644 Tests/Integration/integration_template.config.ps1 create mode 100644 Tests/Integration/integration_template.ps1 create mode 100644 Tests/Unit/unit_template.ps1 diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..29a05dd --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,24 @@ +codecov: + notify: + require_ci_to_pass: no + +comment: + layout: "reach, diff" + behavior: default + +coverage: + range: 50..80 + round: down + precision: 0 + + status: + project: + default: + # Set the overall project code coverage requirement to 70% + target: 70 + patch: + default: + # Set the pull request requirement to not regress overall coverage by more than 5% + # and let codecov.io set the goal for the code changed in the patch. + target: auto + threshold: 5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c333d23 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +DSCResource.Tests +.vs +.vscode +node_modules diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..87b7da5 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,10 @@ +{ + "default": true, + "MD029": { + "style": "one" + }, + "MD013": true, + "MD024": false, + "MD034": false, + "no-hard-tabs": true +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..87c4308 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "powershell.codeFormatting.openBraceOnSameLine": false, + "powershell.codeFormatting.newLineAfterOpenBrace": false, + "powershell.codeFormatting.newLineAfterCloseBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, + "powershell.codeFormatting.whitespaceBeforeOpenParen": true, + "powershell.codeFormatting.whitespaceAroundOperator": true, + "powershell.codeFormatting.whitespaceAfterSeparator": true, + "powershell.codeFormatting.ignoreOneLineBlock": false, + "powershell.codeFormatting.preset": "Custom", + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true +} diff --git a/README.md b/README.md index 61ba94a..d413ba2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xbitlocker/branch/master) - # xBitlocker + The **xBitlocker** module is a part of the Windows PowerShell Desired State Configuration (DSC) Resource Kit, which is a collection of DSC Resources produced by the PowerShell Team. This module contains the **xBLAutoBitlocker, xBLBitlocker, xBLTpm** resources. This DSC Module allows you to configure Bitlocker on a single disk, configure a TPM chip, or automatically enable Bitlocker on multiple disks. @@ -8,6 +7,26 @@ This DSC Module allows you to configure Bitlocker on a single disk, configure a This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +## Branches + +### master + +[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/xBitlocker/branch/master) +[![codecov](https://codecov.io/gh/PowerShell/xBitlocker/branch/master/graph/badge.svg)](https://codecov.io/gh/PowerShell/xBitlocker/branch/master) + +This is the branch containing the latest release - +no contributions should be made directly to this branch. + +### dev + +[![Build status](https://ci.appveyor.com/api/projects/status/wi5i60tojfd7056b/branch/dev?svg=true)](https://ci.appveyor.com/project/PowerShell/xBitlocker/branch/dev) +[![codecov](https://codecov.io/gh/PowerShell/xBitlocker/branch/dev/graph/badge.svg)](https://codecov.io/gh/PowerShell/xBitlocker/branch/dev) + +This is the development branch +to which contributions should be proposed by contributors as pull requests. +This development branch will periodically be merged to the master branch, +and be released to [PowerShell Gallery](https://www.powershellgallery.com/). + ## Contributing Please check out common DSC Resources [contributing guidelines](https://github.com/PowerShell/DscResource.Kit/blob/master/CONTRIBUTING.md). @@ -17,9 +36,9 @@ To install **xBitlocker** module * Unzip the content under $env:ProgramFiles\WindowsPowerShell\Modules folder -To confirm installation: +To confirm installation: -* Run **Get-DSCResource** to see that **xBLAutoBitlocker, xBLBitlocker, xBLTpm** are among the DSC Resources listed +* Run **Get-DSCResource** to see that **xBLAutoBitlocker, xBLBitlocker, xBLTpm** are among the DSC Resources listed ## Requirements @@ -40,68 +59,78 @@ 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, as reported by Get-Volume, to auto apply Bitlocker to * *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 -* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock -* AdAccountOrGroup -* AdAccountOrGroupProtector -* EncryptionMethod -* HardwareEncryption -* Password -* PasswordProtector -* Pin -* RecoveryKeyPath -* RecoveryKeyProtector -* RecoveryPasswordProtector -* Service -* SkipHardwareTest -* StartupKeyPath -* StartupKeyProtector -* TpmProtector -* UsedSpaceOnly +Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" +* MinDiskCapacityGB:If specified, only disks this size or greater will auto apply Bitlocker +* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock +* AdAccountOrGroup +* AdAccountOrGroupProtector +* EncryptionMethod +* HardwareEncryption +* Password +* PasswordProtector +* Pin +* RecoveryKeyPath +* RecoveryKeyProtector +* RecoveryPasswordProtector +* Service +* SkipHardwareTest +* StartupKeyPath +* StartupKeyProtector +* TpmProtector +* UsedSpaceOnly **xBLBitlocker** 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. -* *MountPoint:The MountPoint name as reported in Get-BitLockerVolume +* *MountPoint:The MountPoint name as reported in Get-BitLockerVolume * *PrimaryProtector:The primary protector type to be used for AutoBitlocker. -Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" -* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock +Valid values are: "AdAccountOrGroupProtector", "PasswordProtector", "Pin", "RecoveryKeyProtector", "RecoveryPasswordProtector", "StartupKeyProtector", or "TpmProtector" +* AutoUnlock:Whether volumes should be enabled for auto unlock using Enable-BitlockerAutoUnlock * AllowImmediateReboot:Whether the computer can be immediately rebooted after enabling Bitlocker on an OS drive. Defaults to false. -* AdAccountOrGroup -* AdAccountOrGroupProtector -* EncryptionMethod -* HardwareEncryption -* Password -* PasswordProtector -* Pin -* RecoveryKeyPath -* RecoveryKeyProtector -* RecoveryPasswordProtector -* Service -* SkipHardwareTest -* StartupKeyPath -* StartupKeyProtector -* TpmProtector -* UsedSpaceOnly +* AdAccountOrGroup +* AdAccountOrGroupProtector +* EncryptionMethod +* HardwareEncryption +* Password +* PasswordProtector +* Pin +* RecoveryKeyPath +* RecoveryKeyProtector +* RecoveryPasswordProtector +* Service +* SkipHardwareTest +* StartupKeyPath +* StartupKeyProtector +* TpmProtector +* UsedSpaceOnly **xBLTpm** is used to initialize a TPM chip using [Initialize-TPM](http://technet.microsoft.com/en-us/library/jj603112.aspx). **xBLTpm** has the following properties. -* *Identity:Not actually used, so could be anything -* AllowClear:Indicates that the provisioning process clears the TPM, if necessary, to move the TPM closer to complying with Windows Server® 2012 standards +* *Identity:Not actually used, so could be anything +* AllowClear:Indicates that the provisioning process clears the TPM, if necessary, to move the TPM closer to complying with Windows Server® 2012 standards * AllowPhysicalPresence:Indicates that the provisioning process may send physical presence commands that require a user to be present in order to continue. -* AllowImmediateReboot:Whether the computer can rebooted immediately after initializing the TPM +* AllowImmediateReboot:Whether the computer can rebooted immediately after initializing the TPM ## Versions ### Unreleased + * Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. +* Added Codecov support. +* Updated appveyor.yml to use the one in template. +* Added folders for future unit and integration tests. +* Added Visual Studio Code formatting settings. +* Added .gitignore file. +* Added markdown lint rules. +* Fixed encoding on README.md. +* Added `PowerShellVersion = '4.0'`, and updated copyright information, in the + module manifest. ### 1.1.0.0 @@ -116,10 +145,10 @@ Defaults to false. ### 1.0.0.0 -* Initial release with the following resources - * xBLAutoBitlocker - * xBLBitlocker - * xBLTpm +* Initial release with the following resources + * xBLAutoBitlocker + * xBLBitlocker + * xBLTpm ## Examples @@ -132,4 +161,4 @@ The example code for ConfigureBitlockerOnOSDrive is located in [`ConfigureBitloc Enables Bitlocker on an Operating System drive, and automatically enables Bitlocker on all drives of type 'Fixed'. The example code for ConfigureBitlockerAndAutoBitlocker is located in [`ConfigureBitlockerAndAutoBitlocker.ps1`](Examples/ConfigureBitlockerAndAutoBitlocker/ConfigureBitlockerAndAutoBitlocker.ps1). - + diff --git a/Tests/Integration/integration_template.config.ps1 b/Tests/Integration/integration_template.config.ps1 new file mode 100644 index 0000000..bb36208 --- /dev/null +++ b/Tests/Integration/integration_template.config.ps1 @@ -0,0 +1,26 @@ +<# +.Synopsis + DSC Configuration Template for DSC Resource Integration tests. +.DESCRIPTION + To Use: + 1. Copy to \Tests\Integration\ folder and rename .config.ps1 (e.g. MSFT_Firewall.config.ps1) + 2. Customize TODO sections. + +.NOTES +#> + +# Integration Test Config Template Version: 1.0.1 + +# TODO: Modify ResourceName (e.g. MSFT_Firewall_config) +configuration _config { + # TODO: Modify ModuleName (e.g. NetworkingDsc) + Import-DscResource -ModuleName '' + node localhost { + # TODO: Modify ResourceFriendlyName (e.g. Firewall_Integration_Test) + Integration_Test { + # TODO: Fill Configuration Code Here + } + } +} + +# TODO: (Optional): Add More Configuration Templates diff --git a/Tests/Integration/integration_template.ps1 b/Tests/Integration/integration_template.ps1 new file mode 100644 index 0000000..346818a --- /dev/null +++ b/Tests/Integration/integration_template.ps1 @@ -0,0 +1,87 @@ +<# +.Synopsis + Template for creating DSC Resource Integration Tests +.DESCRIPTION + To Use: + 1. Copy to \Tests\Integration\ folder and rename .Integration.tests.ps1 (e.g. MSFT_Firewall.Integration.tests.ps1) + 2. Customize TODO sections. + 3. Create test DSC Configuration file .config.ps1 (e.g. MSFT_Firewall.config.ps1) from integration_config_template.ps1 file. + +.NOTES + Code in HEADER, FOOTER and DEFAULT TEST regions are standard and may be moved into + DSCResource.Tools in Future and therefore should not be altered if possible. +#> + +# TODO: Customize these parameters... +$script:DSCModuleName = '' # Example NetworkingDsc +$script:DSCResourceName = '' # Example MSFT_Firewall + +#region HEADER +# Integration Test Template Version: 1.2.1 +[String] $script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` + (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) +{ + & git @('clone', 'https://github.com/PowerShell/DscResource.Tests.git', (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests')) +} + +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force +$TestEnvironment = Initialize-TestEnvironment ` + -DSCModuleName $script:DSCModuleName ` + -DSCResourceName $script:DSCResourceName ` + -TestType Integration + +#endregion + +# TODO: Other Init Code Goes Here... + +# Using try/finally to always cleanup. +try +{ + #region Integration Tests + $configFile = Join-Path -Path $PSScriptRoot -ChildPath "$($script:DSCResourceName).config.ps1" + . $configFile + + Describe "$($script:DSCResourceName)_Integration" { + #region DEFAULT TESTS + It 'Should compile and apply the MOF without throwing' { + { + & "$($script:DSCResourceName)_Config" -OutputPath $TestDrive + + $startDscConfigurationParameters = @{ + Path = $TestDrive + ComputerName = 'localhost' + Wait = $true + Verbose = $true + Force = $true + ErrorAction = 'Stop' + } + + Start-DscConfiguration @startDscConfigurationParameters + } | Should -Not -Throw + } + + It 'Should be able to call Get-DscConfiguration without throwing' { + { + Get-DscConfiguration -Verbose -ErrorAction Stop + } | Should -Not -Throw + } + #endregion + + It 'Should have set the resource and all the parameters should match' { + # TODO: Validate the Config was Set Correctly Here... + } + } + #endregion + +} +finally +{ + #region FOOTER + + Restore-TestEnvironment -TestEnvironment $TestEnvironment + + #endregion + + # TODO: Other Optional Cleanup Code Goes Here... +} diff --git a/Tests/Unit/unit_template.ps1 b/Tests/Unit/unit_template.ps1 new file mode 100644 index 0000000..368a2e3 --- /dev/null +++ b/Tests/Unit/unit_template.ps1 @@ -0,0 +1,110 @@ +<# + .SYNOPSIS + Template for creating DSC Resource Unit Tests + .DESCRIPTION + To Use: + 1. Copy to \Tests\Unit\ folder and rename .tests.ps1 (e.g. MSFT_xFirewall.tests.ps1) + 2. Customize TODO sections. + 3. Delete all template comments (TODOs, etc.) + + .NOTES + There are multiple methods for writing unit tests. This template provides a few examples + which you are welcome to follow but depending on your resource, you may want to + design it differently. Read through our TestsGuidelines.md file for an intro on how to + write unit tests for DSC resources: https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md +#> + +#region HEADER + +# Unit Test Template Version: 1.2.1 +$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` + (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) +{ + & git @('clone','https://github.com/PowerShell/DscResource.Tests.git',(Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests')) +} + +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force + +# TODO: Insert the correct and for your resource +$TestEnvironment = Initialize-TestEnvironment ` + -DSCModuleName '' ` + -DSCResourceName '' ` + -TestType Unit + +#endregion HEADER + +function Invoke-TestSetup { + # TODO: Optional init code goes here... +} + +function Invoke-TestCleanup { + Restore-TestEnvironment -TestEnvironment $TestEnvironment + + # TODO: Other Optional Cleanup Code Goes Here... +} + +# Begin Testing +try +{ + Invoke-TestSetup + + InModuleScope '' { + # TODO: Optionally create any variables here for use by your tests + + # TODO: Complete the Describe blocks below and add more as needed. + # The most common method for unit testing is to test by function. For more information + # check out this introduction to writing unit tests in Pester: + # https://www.simple-talk.com/sysadmin/powershell/practical-powershell-unit-testing-getting-started/#eleventh + # You may also follow one of the patterns provided in the TestsGuidelines.md file: + # https://github.com/PowerShell/DscResources/blob/master/TestsGuidelines.md + + Describe '' { + BeforeEach { + # per-test-initialization + } + + AfterEach { + # per-test-cleanup + } + + Context 'Context-description' { + BeforeEach { + # per-test-initialization + } + + AfterEach { + # per-test-cleanup + } + + It 'Should...test-description' { + # test-code + } + + It 'Should...test-description' { + # test-code + } + } + + Context 'Context-description' { + It 'Should ....test-description' { + # test-code + } + } + } + + Describe '' { + Context '' { + It 'Should ...test-description' { + # test-code + } + } + } + + # TODO: add more Describe blocks as needed + } +} +finally +{ + Invoke-TestCleanup +} diff --git a/appveyor.yml b/appveyor.yml index 22fe6aa..1f648e1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,63 +1,33 @@ -#---------------------------------# -# environment configuration # -#---------------------------------# +#---------------------------------# +# environment configuration # +#---------------------------------# + version: 1.1.{build}.0 install: - git clone https://github.com/PowerShell/DscResource.Tests - - ps: | - Import-Module -Name .\DscResource.Tests\TestHelper.psm1 -Force - Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force - Install-Module -Name Pester -Repository PSGallery -Force + - ps: Write-Verbose -Message "PowerShell version $($PSVersionTable.PSVersion)" -Verbose + - ps: Import-Module "$env:APPVEYOR_BUILD_FOLDER\DscResource.Tests\AppVeyor.psm1" + - ps: Invoke-AppveyorInstallTask -#---------------------------------# -# build configuration # -#---------------------------------# +#---------------------------------# +# build configuration # +#---------------------------------# build: false -#---------------------------------# -# test configuration # -#---------------------------------# +#---------------------------------# +# test configuration # +#---------------------------------# test_script: - ps: | - $testResultsFile = ".\TestsResults.xml" - $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru - (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) - if ($res.FailedCount -gt 0) { - throw "$($res.FailedCount) tests failed." - } - -#---------------------------------# -# deployment configuration # -#---------------------------------# - -# scripts to run before deployment -deploy_script: - - ps: | - # Creating project artifact - $stagingDirectory = (Resolve-Path ..).Path - $manifest = Join-Path $pwd "xBitlocker.psd1" - (Get-Content $manifest -Raw).Replace("1.1.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest - $zipFilePath = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" - Add-Type -assemblyname System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) - - # Creating NuGet package artifact - New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . - nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory . - $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName - - @( - # You can add other artifacts here - $zipFilePath, - $nuGetPackagePath - ) | % { - Write-Host "Pushing package $_ as Appveyor artifact" - Push-AppveyorArtifact $_ - } - - + Invoke-AppveyorTestScriptTask -CodeCoverage -CodeCovIo -ExcludeTag @() +#---------------------------------# +# deployment configuration # +#---------------------------------# +# scripts to run before deployment +deploy_script: + - ps: | + Invoke-AppveyorAfterTestTask diff --git a/xBitlocker.psd1 b/xBitlocker.psd1 index 50e5cbc..a2aeb8f 100644 --- a/xBitlocker.psd1 +++ b/xBitlocker.psd1 @@ -1,10 +1,4 @@ -# -# Module manifest for module 'xBitlocker' -# -# Generated by: Mike Hendrickson -# -# Generated on: 8/29/2014 -# + @{ @@ -18,19 +12,19 @@ ModuleVersion = '1.1.0.0' GUID = 'dc4f3fd0-4e1d-4916-84f8-d0bb89d52507' # Author of this module -Author = 'Mike Hendrickson' +Author = 'Microsoft Corporation' # Company or vendor of this module -CompanyName = 'Microsoft' +CompanyName = 'Microsoft Corporation' # Copyright statement for this module -Copyright = '(c) 2014 administrator. All rights reserved.' +Copyright = '(c) 2018 Microsoft Corporation. All rights reserved.' # Description of the functionality provided by this module Description = 'This DSC Module allows you to configure Bitlocker on a single disk, configure a TPM chip, or automatically enable Bitlocker on multiple disks.' # Minimum version of the Windows PowerShell engine required by this module -# PowerShellVersion = '' +PowerShellVersion = '4.0' # Name of the Windows PowerShell host required by this module # PowerShellHostName = '' From 3a48bcfb82ee2eb6e2dfd5445300a7d5e1753a3b Mon Sep 17 00:00:00 2001 From: Martin Vokurek Date: Thu, 31 May 2018 18:37:04 +0200 Subject: [PATCH 07/10] Correctly handles fully decrypted volumes when correct Key Protectors is present (#16) - Fixed issue which caused Test-TargetResource to incorrectly succeed on fully decrypted volumes when correct Key Protectors were present (issue #13) --- Misc/xBitlockerCommon.psm1 | 17 ++-- README.md | 2 + Tests/Unit/xBitlockerCommon.tests.ps1 | 108 ++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 Tests/Unit/xBitlockerCommon.tests.ps1 diff --git a/Misc/xBitlockerCommon.psm1 b/Misc/xBitlockerCommon.psm1 index a89d9e0..ac234e2 100644 --- a/Misc/xBitlockerCommon.psm1 +++ b/Misc/xBitlockerCommon.psm1 @@ -86,7 +86,7 @@ function EnableBitlocker { throw "A TpmProtector must be used if Pin is used." } - + if ($PSBoundParameters.ContainsKey("AdAccountOrGroupProtector") -and $PrimaryProtector -notlike "AdAccountOrGroupProtector" -and !(ContainsKeyProtector -Type "AdAccountOrGroup" -KeyProtectorCollection $blv.KeyProtector)) { Write-Verbose "Adding AdAccountOrGroupProtector" @@ -164,7 +164,7 @@ function EnableBitlocker $handledTpmAlready = $true $params.Add("Pin", $Pin.Password) - + if ($PSBoundParameters.ContainsKey("StartupKeyProtector")) { $params.Add("TpmAndPinAndStartupKeyProtector", $true) @@ -181,7 +181,7 @@ function EnableBitlocker $handledTpmAlready = $true $params.Add("TpmAndStartupKeyProtector", $true) - $params.Add("StartupKeyPath", $StartupKeyPath) + $params.Add("StartupKeyPath", $StartupKeyPath) } @@ -325,6 +325,11 @@ function TestBitlocker Write-Verbose "Unable to locate MountPoint: $($MountPoint)" return $false } + elseif ($blv.VolumeStatus -eq "FullyDecrypted") + { + Write-Verbose "MountPoint: $($MountPoint) Not Encrypted" + return $false + } elseif ($blv.KeyProtector -eq $null -or $blv.KeyProtector.Count -eq 0) { Write-Verbose "No key protectors on MountPoint: $($MountPoint)" @@ -352,7 +357,7 @@ function TestBitlocker if ($PSBoundParameters.ContainsKey("Pin") -and !(ContainsKeyProtector -Type "TpmPin" -KeyProtectorCollection $blv.KeyProtector -StartsWith $true)) { Write-Verbose "MountPoint '$($MountPoint) 'does not have TpmPin assigned." - return $false + return $false } if ($PSBoundParameters.ContainsKey("RecoveryKeyProtector") -and !(ContainsKeyProtector -Type "ExternalKey" -KeyProtectorCollection $blv.KeyProtector)) @@ -383,7 +388,7 @@ function TestBitlocker { Write-Verbose "MountPoint '$($MountPoint) 'does not have TPM + StartupKey protector." return $false - } + } } } @@ -397,7 +402,7 @@ function TestBitlocker return $true } -#Ensures that required Bitlocker prereqs are installed +#Ensures that required Bitlocker prereqs are installed function CheckForPreReqs { $hasAllPreReqs = $true diff --git a/README.md b/README.md index d413ba2..da64451 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,8 @@ Defaults to false. * Fixed encoding on README.md. * 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)) + ### 1.1.0.0 diff --git a/Tests/Unit/xBitlockerCommon.tests.ps1 b/Tests/Unit/xBitlockerCommon.tests.ps1 new file mode 100644 index 0000000..566e93a --- /dev/null +++ b/Tests/Unit/xBitlockerCommon.tests.ps1 @@ -0,0 +1,108 @@ +$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'Misc' -ChildPath 'xBitlockerCommon.psm1')) -Force + +# Begin Testing +try +{ + InModuleScope "xBitlockerCommon" { + + function Get-BitlockerVolume + { + param + ( + [Parameter()] + [System.String] + $MountPoint + ) + } + + Describe "xBitlockerCommon\TestBitlocker" { + + Context 'When OS Volume is not Encrypted and No Key Protectors Assigned' { + Mock ` + -CommandName Get-BitlockerVolume ` + -ModuleName 'xBitlockerCommon' ` + -MockWith { + # Decrypted with no Key Protectors + return @{ + VolumeType = 'OperatingSystem' + MountPoint = $MountPoint + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @() + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + } + } + + It 'Should Fail The Test (TPM and RecoveryPassword Protectors)' { + TestBitlocker -MountPoint 'C:' -PrimaryProtector 'TPMProtector' -RecoveryPasswordProtector $true | Should -Be $false + } + } + + Context 'When OS Volume is Encrypted using TPM and Recovery Password Protectors' { + Mock ` + -CommandName Get-BitlockerVolume ` + -ModuleName 'xBitlockerCommon' ` + -MockWith { + # Encrypted with TPM and Recovery Password Key Protectors + return @{ + VolumeType = 'OperatingSystem' + MountPoint = $MountPoint + CapacityGB = 500 + VolumeStatus = 'FullyEncrypted' + EncryptionPercentage = 100 + KeyProtector = @( + @{ + KeyProtectorType = 'Tpm' + }, + @{ + KeyProtectorType = 'RecoveryPassword' + } + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'On' + } + } + + It 'Should Pass The Test (TPM and RecoveryPassword Protectors)' { + TestBitlocker -MountPoint 'C:' -PrimaryProtector 'TPMProtector' -RecoveryPasswordProtector $true -verbose | Should -Be $true + } + } + + Context 'When OS Volume is Decrypted, but has TPM and Recovery Password Protectors assigned' { + Mock ` + -CommandName Get-BitlockerVolume ` + -ModuleName 'xBitlockerCommon' ` + -MockWith { + # Encrypted with TPM and Recovery Password Key Protectors + return @{ + VolumeType = 'OperatingSystem' + MountPoint = $MountPoint + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + @{ + KeyProtectorType = 'Tpm' + }, + @{ + KeyProtectorType = 'RecoveryPassword' + } + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + } + } + + It 'Should Fail The Test (TPM and RecoveryPassword Protectors)' { + TestBitlocker -MountPoint 'C:' -PrimaryProtector 'TPMProtector' -RecoveryPasswordProtector $true | Should -Be $false + } + } + } + } +} +finally +{ +} From 609e54dab1848e22d58e8b2d01ede4199dc7cb33 Mon Sep 17 00:00:00 2001 From: Martin Vokurek Date: Tue, 5 Jun 2018 09:58:00 +0200 Subject: [PATCH 08/10] Fix for Issues #10 and #11 (#17) - 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). --- .../MSFT_xBLAutoBitlocker.psm1 | 38 +- README.md | 5 +- Tests/Unit/MSFT_xBLAutoBitlocker.tests.ps1 | 365 ++++++++++++++++++ 3 files changed, 401 insertions(+), 7 deletions(-) create mode 100644 Tests/Unit/MSFT_xBLAutoBitlocker.tests.ps1 diff --git a/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 b/DSCResources/MSFT_xBLAutoBitlocker/MSFT_xBLAutoBitlocker.psm1 index 74a1d6b..45d773f 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 @@ -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 @@ -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 @@ -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) { diff --git a/README.md b/README.md index da64451..ac630ab 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/Tests/Unit/MSFT_xBLAutoBitlocker.tests.ps1 b/Tests/Unit/MSFT_xBLAutoBitlocker.tests.ps1 new file mode 100644 index 0000000..a164f3a --- /dev/null +++ b/Tests/Unit/MSFT_xBLAutoBitlocker.tests.ps1 @@ -0,0 +1,365 @@ +#region HEADER + +# Unit Test Template Version: 1.2.1 +$script:moduleRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot) +if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` + (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) +{ + & git @('clone','https://github.com/PowerShell/DscResource.Tests.git',(Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests')) +} + +Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -Path 'DSCResource.Tests' -ChildPath 'TestHelper.psm1')) -Force + +$TestEnvironment = Initialize-TestEnvironment ` + -DSCModuleName 'xBitlocker' ` + -DSCResourceName 'MSFT_xBLAutoBitlocker' ` + -TestType Unit + +#endregion HEADER + +function Invoke-TestCleanup { + Restore-TestEnvironment -TestEnvironment $TestEnvironment +} + +# Begin Testing +try +{ + InModuleScope 'MSFT_xBLAutoBitlocker' { + + function Get-BitLockerVolume { + param + ( + [Parameter()] + [System.String[]] + $MountPoint + ) + } + + # Get-BitlockerVolume is used to obtain list of volumes in the system and their current encryption status + Mock ` + -CommandName Get-BitlockerVolume ` + -ModuleName 'MSFT_xBLAutoBitlocker' ` + -MockWith { + # Returns a collection of OS/Fixed/Removable disks with correct/incorrect removable status + return @( + @{ + # C: is OS drive + VolumeType = 'OperatingSystem' + MountPoint = 'C:' + CapacityGB = 500 + VolumeStatus = 'FullyEncrypted' + EncryptionPercentage = 100 + KeyProtector = @( + @{ + KeyProtectorType = 'Tpm' + }, + @{ + KeyProtectorType = 'RecoveryPassword' + } + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'On' + }, + @{ + # D: is Fixed drive, incorrectly reporting as Removable to Bitlocker + VolumeType = 'Data' + MountPoint = 'D:' + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + }, + @{ + # E: is Fixed drive, correctly reporting as Fixed to Bitlocker + VolumeType = 'Data' + MountPoint = 'E:' + CapacityGB = 50 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + } + @{ + # F: is a Removable drive thumb drive, correctly reporting as Removable to Bitlocker + VolumeType = 'Data' + MountPoint = 'F:' + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + }, + @{ + # 1 is Fixed drive, incorrectly reporting as Removable to Bitlocker + VolumeType = 'Data' + MountPoint = '\\?\Volume{00000000-0000-0000-0000-000000000001}\' + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + }, + @{ + # 2 is Fixed drive, correctly reporting as Fixed to Bitlocker + VolumeType = 'Data' + MountPoint = '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + } + @{ + # 3 is a Removable drive thumb drive, correctly reporting as Removable to Bitlocker + VolumeType = 'Data' + MountPoint = '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + CapacityGB = 50 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' + } + ) + } + + # Get-Volume evaluates volume removable status correctly + # This was used in broken version of the module, replaced in Issue #11 by Win32_EncryptableVolume class + Mock ` + -CommandName Get-Volume ` + -ModuleName 'MSFT_xBLAutoBitlocker' ` + -MockWith { + # Returns a collection of OS/Fixed/Removable disks with correct/incorrect removable status + + switch ($Path) + { + '\\?\Volume{00000000-0000-0000-0000-000000000001}\' + { + return @{ + # D: is Fixed drive, incorrectly reporting as Removable to Bitlocker + DriveLetter = '' + Path = '\\?\Volume{00000000-0000-0000-0000-000000000001}\' + DriveType = 'Fixed' + } + } + '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + { + return @{ + # 2 is Fixed drive, correctly reporting as Fixed to Bitlocker + DriveLetter = '' + Path = '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + DriveType = 'Fixed' + } + } + '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + { + return @{ + # 3 is a Removable drive, correctly reporting as Fixed to Bitlocker + DriveLetter = '' + Path = '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + DriveType = 'Removable' + } + } + default + { + throw "No MSFT_Volume objects found with property 'Path' equal to '$Path'. Verify the value of the property and retry." + } + } + } + + Mock ` + -CommandName Get-CimInstance ` + -ModuleName 'MSFT_xBLAutoBitlocker' ` + -MockWith { + # Returns a collection of OS/Fixed/Removable disks with correct/incorrect removable status + return @( + @{ + # C: is OS drive + DriveLetter = 'C:' + VolumeType=0 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000000}\' + + }, + @{ + # D: is Fixed drive, incorrectly reporting as Removable to Bitlocker + DriveLetter = 'D:' + VolumeType=2 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000004}\' + + }, + @{ + # E: is Fixed drive, correctly reporting as Fixed to Bitlocker + DriveLetter = 'E:' + VolumeType=1 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000005}\' + + }, + @{ + # F: is a Removable drive, correctly reporting as Fixed to Bitlocker + DriveLetter = 'F:' + VolumeType=2 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000006}\' + }, + @{ + # 1 is Fixed drive, incorrectly reporting as Removable to Bitlocker + DriveLetter = '' + VolumeType=2 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000001}\' + }, + @{ + # 2 is Fixed drive, correctly reporting as Fixed to Bitlocker + DriveLetter = '' + VolumeType=1 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000002}\' + }, + @{ + # 3 is a Removable drive, correctly reporting as Fixed to Bitlocker + DriveLetter = '' + VolumeType=2 + DeviceID='\\?\Volume{00000000-0000-0000-0000-000000000003}\' + } + + ) + } + + Describe 'MSFT_xBLAutoBitlocker\GetAutoBitlockerStatus' { + + Context 'When Volume C: Reports as OS Volume' { + + It 'Should Not Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector TpmProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain 'C:' + } + + It 'Should Not Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector TpmProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain 'C:' + } + } + + Context 'When Volume D: Reports Fixed to OS, but Removable to Bitlocker' { + + It 'Should Not Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain 'D:' + } + + It 'Should Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain 'D:' + } + } + + Context 'When Volume E: Reports Fixed to OS and Bitlocker' { + + It 'Should Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain 'E:' + } + + It 'Should Not Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain 'E:' + } + } + + Context 'When Volume F: Reports as Removable to OS and Bitlocker' { + + It 'Should Not Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain 'F:' + } + + It 'Should Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain 'F:' + } + } + + Context 'When Volume \\?\Volume{00000000-0000-0000-0000-000000000001}\ Reports Fixed to OS, but Removable to Bitlocker' { + + It 'Should Not Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain '\\?\Volume{00000000-0000-0000-0000-000000000001}\' + } + + It 'Should Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain '\\?\Volume{00000000-0000-0000-0000-000000000001}\' + } + } + + Context 'When Volume \\?\Volume{00000000-0000-0000-0000-000000000002}\ Reports Fixed to OS and Bitlocker' { + + It 'Should Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + } + + It 'Should Not Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + } + } + + Context 'When Volume \\?\Volume{00000000-0000-0000-0000-000000000003}\ Reports as Removable to OS and Bitlocker' { + + It 'Should Not Be In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Not -Contain '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + } + + It 'Should Be In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + } + } + + Context 'When MinDiskCapacity Parameter is Defined at 100 GB for Fixed Disks' { + + It 'Should Exclude E: from The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector -MinDiskCapacityGB 100|Select-Object -ExpandProperty Keys)|Should -Not -Contain 'E:' + } + + It 'Should Include Volume \\?\Volume{00000000-0000-0000-0000-000000000002}\ In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector -MinDiskCapacityGB 100|Select-Object -ExpandProperty Keys)|Should -Contain '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + } + } + + Context 'When MinDiskCapacity Parameter is Not Defined for Fixed Disks' { + + It 'Should Include E: In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain 'E:' + } + + It 'Should Include Volume \\?\Volume{00000000-0000-0000-0000-000000000002}\ In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Fixed' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain '\\?\Volume{00000000-0000-0000-0000-000000000002}\' + } + } + + Context 'When MinDiskCapacity Parameter is Defined at 100 GB for Removable Disks' { + + It 'Should Exclude \\?\Volume{00000000-0000-0000-0000-000000000003}\ from The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector -MinDiskCapacityGB 100|Select-Object -ExpandProperty Keys)|Should -Not -Contain '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + } + + It 'Should Include F: In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector -MinDiskCapacityGB 100|Select-Object -ExpandProperty Keys)|Should -Contain 'F:' + } + } + + Context 'When MinDiskCapacity Parameter is Not Defined for Fixed Disks' { + + It 'Should Include \\?\Volume{00000000-0000-0000-0000-000000000003}\ In The List of Eligible Fixed Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain '\\?\Volume{00000000-0000-0000-0000-000000000003}\' + } + + It 'Should Include F: In The List of Eligible Removable Volumes' { + (GetAutoBitlockerStatus -DriveType 'Removable' -PrimaryProtector RecoveryPasswordProtector|Select-Object -ExpandProperty Keys)|Should -Contain 'F:' + } + } + } + } +} +finally +{ + Invoke-TestCleanup +} From c83785e4fa54751f6a2540df529171ba3a8925d2 Mon Sep 17 00:00:00 2001 From: Jonas Feller Date: Tue, 12 Jun 2018 09:09:53 +0200 Subject: [PATCH 09/10] Fix for Issue #8 (#9) - Fixed an issue in CheckForPreReqs function where on Server Core the installation of the non existing Windows Feature 'RSAT-Feature-Tools-BitLocker-RemoteAdminTool' was erroneously checked (issue #8). --- Misc/xBitlockerCommon.psm1 | 12 +- README.md | 2 + Tests/Unit/xBitlockerCommon.tests.ps1 | 319 ++++++++++++++++++++++---- xBitlocker.psd1 | 2 +- 4 files changed, 284 insertions(+), 51 deletions(-) diff --git a/Misc/xBitlockerCommon.psm1 b/Misc/xBitlockerCommon.psm1 index ac234e2..a0825ab 100644 --- a/Misc/xBitlockerCommon.psm1 +++ b/Misc/xBitlockerCommon.psm1 @@ -425,7 +425,7 @@ function CheckForPreReqs Write-Error "The RSAT-Feature-Tools-BitLocker feature needs to be installed before the xBitlocker module can be used" } - if ($blAdminToolsRemoteFeature.InstallState -ne "Installed") + if ($blAdminToolsRemoteFeature.InstallState -ne 'Installed' -and (Get-OSEdition) -notmatch 'Core') { $hasAllPreReqs = $false @@ -518,4 +518,14 @@ function RemoveParameters } } +<# +.SYNOPSIS +Returns the OS edtion we currently running on +#> +function Get-OSEdition +{ + (Get-ItemProperty -Path 'HKLM:/software/microsoft/windows nt/currentversion' -Name InstallationType).InstallationType +} + + Export-ModuleMember -Function * diff --git a/README.md b/README.md index ac630ab..052afe6 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,8 @@ Defaults to false. * 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)) +* Fixed an issue in CheckForPreReqs function where on Server Core the installation of the non existing Windows Feature 'RSAT-Feature-Tools-BitLocker-RemoteAdminTool' was erroneously checked. ([issue #8](https://github.com/PowerShell/xBitlocker/issues/8)) + ### 1.1.0.0 diff --git a/Tests/Unit/xBitlockerCommon.tests.ps1 b/Tests/Unit/xBitlockerCommon.tests.ps1 index 566e93a..608e1e9 100644 --- a/Tests/Unit/xBitlockerCommon.tests.ps1 +++ b/Tests/Unit/xBitlockerCommon.tests.ps1 @@ -4,7 +4,7 @@ Import-Module -Name (Join-Path -Path $script:moduleRoot -ChildPath (Join-Path -P # Begin Testing try { - InModuleScope "xBitlockerCommon" { + InModuleScope 'xBitlockerCommon' { function Get-BitlockerVolume { @@ -16,25 +16,25 @@ try ) } - Describe "xBitlockerCommon\TestBitlocker" { + Describe 'xBitlockerCommon\TestBitlocker' { Context 'When OS Volume is not Encrypted and No Key Protectors Assigned' { Mock ` -CommandName Get-BitlockerVolume ` -ModuleName 'xBitlockerCommon' ` -MockWith { - # Decrypted with no Key Protectors - return @{ - VolumeType = 'OperatingSystem' - MountPoint = $MountPoint - CapacityGB = 500 - VolumeStatus = 'FullyDecrypted' - EncryptionPercentage = 0 - KeyProtector = @() - AutoUnlockEnabled = $null - ProtectionStatus = 'Off' - } + # Decrypted with no Key Protectors + return @{ + VolumeType = 'OperatingSystem' + MountPoint = $MountPoint + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @() + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' } + } It 'Should Fail The Test (TPM and RecoveryPassword Protectors)' { TestBitlocker -MountPoint 'C:' -PrimaryProtector 'TPMProtector' -RecoveryPasswordProtector $true | Should -Be $false @@ -46,25 +46,25 @@ try -CommandName Get-BitlockerVolume ` -ModuleName 'xBitlockerCommon' ` -MockWith { - # Encrypted with TPM and Recovery Password Key Protectors - return @{ - VolumeType = 'OperatingSystem' - MountPoint = $MountPoint - CapacityGB = 500 - VolumeStatus = 'FullyEncrypted' - EncryptionPercentage = 100 - KeyProtector = @( - @{ - KeyProtectorType = 'Tpm' - }, - @{ - KeyProtectorType = 'RecoveryPassword' - } - ) - AutoUnlockEnabled = $null - ProtectionStatus = 'On' - } + # Encrypted with TPM and Recovery Password Key Protectors + return @{ + VolumeType = 'OperatingSystem' + MountPoint = $MountPoint + CapacityGB = 500 + VolumeStatus = 'FullyEncrypted' + EncryptionPercentage = 100 + KeyProtector = @( + @{ + KeyProtectorType = 'Tpm' + }, + @{ + KeyProtectorType = 'RecoveryPassword' + } + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'On' } + } It 'Should Pass The Test (TPM and RecoveryPassword Protectors)' { TestBitlocker -MountPoint 'C:' -PrimaryProtector 'TPMProtector' -RecoveryPasswordProtector $true -verbose | Should -Be $true @@ -76,31 +76,252 @@ try -CommandName Get-BitlockerVolume ` -ModuleName 'xBitlockerCommon' ` -MockWith { - # Encrypted with TPM and Recovery Password Key Protectors - return @{ - VolumeType = 'OperatingSystem' - MountPoint = $MountPoint - CapacityGB = 500 - VolumeStatus = 'FullyDecrypted' - EncryptionPercentage = 0 - KeyProtector = @( - @{ - KeyProtectorType = 'Tpm' - }, - @{ - KeyProtectorType = 'RecoveryPassword' - } - ) - AutoUnlockEnabled = $null - ProtectionStatus = 'Off' - } + # Encrypted with TPM and Recovery Password Key Protectors + return @{ + VolumeType = 'OperatingSystem' + MountPoint = $MountPoint + CapacityGB = 500 + VolumeStatus = 'FullyDecrypted' + EncryptionPercentage = 0 + KeyProtector = @( + @{ + KeyProtectorType = 'Tpm' + }, + @{ + KeyProtectorType = 'RecoveryPassword' + } + ) + AutoUnlockEnabled = $null + ProtectionStatus = 'Off' } + } It 'Should Fail The Test (TPM and RecoveryPassword Protectors)' { TestBitlocker -MountPoint 'C:' -PrimaryProtector 'TPMProtector' -RecoveryPasswordProtector $true | Should -Be $false } } } + + Describe 'xBitlockerCommon\CheckForPreReqs' { + function Get-WindowsFeature + { + param + ( + [string] + $FeatureName + ) + } + + function Get-OSEdition + { + + } + + Context 'When OS is Server Core and all required features are installed' { + Mock -CommandName Get-OSEdition -MockWith { + 'Server Core' + } + + Mock -CommandName Get-WindowsFeature -MockWith { + if ($FeatureName -eq 'RSAT-Feature-Tools-BitLocker-RemoteAdminTool') + { + return $null + } + else + { + return @{ + DisplayName = $FeatureName + Name = $FeatureName + InstallState = 'Installed' + } + } + } + + It 'Should not generate any error messages' { + Mock -CommandName Write-Error + CheckForPreReqs + Assert-MockCalled -Command Write-Error -Exactly -Times 0 -Scope It + } + + It 'Should run the CheckForPreReqs function without exceptions' { + {CheckForPreReqs} | Should -Not -Throw + } + } + + Context 'When OS is Full Server and all required features are installed' { + Mock -CommandName Get-OSEdition -MockWith { + return 'Server' + } + + Mock -CommandName Get-WindowsFeature -MockWith { + param + ( + [string] + $FeatureName + ) + + return @{ + DisplayName = $FeatureName + Name = $FeatureName + InstallState = 'Installed' + } + } + + It 'Should not generate any error messages' { + Mock -CommandName Write-Error + CheckForPreReqs + Assert-MockCalled -Command Write-Error -Exactly -Times 0 -Scope It + } + + It 'Should run the CheckForPreReqs function without exceptions' { + {CheckForPreReqs} | Should -Not -Throw + } + } + + Context 'When OS is Full Server without the required features installed' { + Mock -CommandName Get-OSEdition -MockWith { + return 'Server' + } + + Mock -CommandName Get-WindowsFeature -MockWith { + return @{ + DisplayName = $FeatureName + Name = $FeatureName + InstallState = 'Available' + } + } + + Mock -CommandName Write-Error + + It 'Should give an error that Bitlocker Windows Feature needs to be installed' { + {CheckForPreReqs} | Should -Throw + Assert-MockCalled -Command Write-Error -Exactly -Times 1 -Scope It -ParameterFilter { + $Message -eq 'The Bitlocker feature needs to be installed before the xBitlocker module can be used' + } + } + + It 'Should give an error that RSAT-Feature-Tools-BitLocker Windows Feature needs to be installed' { + {CheckForPreReqs} | Should -Throw + Assert-MockCalled -Command Write-Error -Exactly -Times 1 -Scope It -ParameterFilter { + $Message -eq 'The RSAT-Feature-Tools-BitLocker feature needs to be installed before the xBitlocker module can be used' + } + } + + It 'Should give an error that RSAT-Feature-Tools-BitLocker-RemoteAdminTool Windows Feature needs to be installed' { + {CheckForPreReqs} | Should -Throw + Assert-MockCalled -Command Write-Error -Exactly -Times 1 -Scope It -ParameterFilter { + $Message -eq 'The RSAT-Feature-Tools-BitLocker-RemoteAdminTool feature needs to be installed before the xBitlocker module can be used' + } + } + + It 'The CheckForPreReqs function should throw an exceptions about missing required Windows Features' { + {CheckForPreReqs} | Should -Throw 'Required Bitlocker features need to be installed before xBitlocker can be used' + } + } + + Context 'When OS is Server Core without the required features installed' { + Mock -CommandName Get-OSEdition -MockWith { + return 'Server Core' + } + + Mock -CommandName Get-WindowsFeature -MockWith { + param + ( + [string] + $FeatureName + ) + + if ($FeatureName -eq 'RSAT-Feature-Tools-BitLocker-RemoteAdminTool') + { + return $null + } + else + { + + return @{ + DisplayName = $FeatureName + Name = $FeatureName + InstallState = 'Available' + } + } + } + + Mock -CommandName Write-Error + + It 'Should give an error that Bitlocker Windows Feature needs to be installed' { + {CheckForPreReqs} | Should -Throw + Assert-MockCalled -Command Write-Error -Exactly -Times 1 -Scope It -ParameterFilter { + $Message -eq 'The Bitlocker feature needs to be installed before the xBitlocker module can be used' + } + } + + It 'Should give an error that RSAT-Feature-Tools-BitLocker Windows Feature needs to be installed' { + {CheckForPreReqs} | Should -Throw + Assert-MockCalled -Command Write-Error -Exactly -Times 1 -Scope It -ParameterFilter { + $Message -eq 'The RSAT-Feature-Tools-BitLocker feature needs to be installed before the xBitlocker module can be used' + } + } + + It 'Should not give an error that RSAT-Feature-Tools-BitLocker-RemoteAdminTool Windows Feature needs to be installed as this Windows Features is not available on Server Core.' { + {CheckForPreReqs} | Should -Throw + Assert-MockCalled -Command Write-Error -Exactly -Times 0 -Scope It -ParameterFilter { + $Message -eq 'The RSAT-Feature-Tools-BitLocker-RemoteAdminTool feature needs to be installed before the xBitlocker module can be used' + } + } + + It 'The CheckForPreReqs function should throw an exceptions about missing required Windows Features' { + {CheckForPreReqs} | Should -Throw 'Required Bitlocker features need to be installed before xBitlocker can be used' + } + } + } + + Describe 'xBitLockerCommon\Get-OSEdition' { + It 'Should return "Server Core" if the OS is Windows Server Core' { + Mock -CommandName Get-ItemProperty -MockWith { + [PSCustomObject]@{ + InstallationType = 'Server Core' + PSPath = 'Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion' + PSParentPath = 'Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows nt' + PSChildName = 'currentversion' + PSDrive = 'HKLM' + PSProvider = 'Microsoft.PowerShell.Core\Registry' + } + } + + $OSVersion = Get-OSEdition + $OSVersion | Should -Be 'Server Core' + } + + It 'Should return "Server" if the OS is Full Windows Server' { + Mock -CommandName Get-ItemProperty -MockWith { + [PSCustomObject]@{ + InstallationType = 'Server' + PSPath = 'Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion' + PSParentPath = 'Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows nt' + PSChildName = 'currentversion' + PSDrive = 'HKLM' + PSProvider = 'Microsoft.PowerShell.Core\Registry' + } + } + + $OSVersion = Get-OSEdition + $OSVersion | Should -Be 'Server' + } + + It 'Should run without exceptions' { + Mock -CommandName Get-ItemProperty -MockWith { + [PSCustomObject]@{ + InstallationType = 'Some other os' + PSPath = 'Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows nt\currentversion' + PSParentPath = 'Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\microsoft\windows nt' + PSChildName = 'currentversion' + PSDrive = 'HKLM' + PSProvider = 'Microsoft.PowerShell.Core\Registry' + } + } + {Get-OSEdition} | Should -Not -Throw + } + } } } finally diff --git a/xBitlocker.psd1 b/xBitlocker.psd1 index a2aeb8f..b3078e9 100644 --- a/xBitlocker.psd1 +++ b/xBitlocker.psd1 @@ -36,7 +36,7 @@ PowerShellVersion = '4.0' # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module -# CLRVersion = '' +CLRVersion = '4.0' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' From 1bd93edc11c13babd842ddc3146df8505b50ca35 Mon Sep 17 00:00:00 2001 From: Katie Keim Date: Wed, 13 Jun 2018 09:43:47 -0700 Subject: [PATCH 10/10] Releasing version 1.2.0.0 --- README.md | 2 ++ xBitlocker.psd1 | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 052afe6..e0f3aa6 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ Defaults to false. ### Unreleased +### 1.2.0.0 + * Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. * Added Codecov support. * Updated appveyor.yml to use the one in template. diff --git a/xBitlocker.psd1 b/xBitlocker.psd1 index b3078e9..d4f6f54 100644 --- a/xBitlocker.psd1 +++ b/xBitlocker.psd1 @@ -6,7 +6,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '1.1.0.0' +moduleVersion = '1.2.0.0' # ID used to uniquely identify this module GUID = 'dc4f3fd0-4e1d-4916-84f8-d0bb89d52507' @@ -95,7 +95,23 @@ PrivateData = @{ # IconUri = '' # ReleaseNotes of this module - # ReleaseNotes = '' + ReleaseNotes = '* Converted appveyor.yml to install Pester from PSGallery instead of from Chocolatey. +* Added Codecov support. +* Updated appveyor.yml to use the one in template. +* Added folders for future unit and integration tests. +* Added Visual Studio Code formatting settings. +* Added .gitignore file. +* Added markdown lint rules. +* Fixed encoding on README.md. +* 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)) +* Fixed an issue in CheckForPreReqs function where on Server Core the installation of the non existing Windows Feature "RSAT-Feature-Tools-BitLocker-RemoteAdminTool" was erroneously checked. ([issue 8](https://github.com/PowerShell/xBitlocker/issues/8)) + + +' } # End of PSData hashtable @@ -110,3 +126,4 @@ PrivateData = @{ } +