mirror of
https://github.com/freedbygrace/Decrypt-BitlockerVolume.git
synced 2026-08-19 04:46:17 +00:00
Update Decrypt-BitlockerVolume.ps1
This commit is contained in:
+61
-61
@@ -1,72 +1,72 @@
|
|||||||
#Requires -Version 3 -Modules ('Bitlocker', 'Storage')
|
#Requires -Version 3 -Modules ('Bitlocker', 'Storage')
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Provides the ability to remove Bitlocker disk encryption from all volumes located on fixed hard disks. Removable disk(s) will not be included.
|
Provides the ability to remove Bitlocker disk encryption from all volumes located on fixed hard disks. Removable disk(s) will not be included.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
By default, only the operating system volume will be decrypted. Modify the regular expression parameter(s) to achieve the desired scenario.
|
By default, only the operating system volume will be decrypted. Modify the regular expression parameter(s) to achieve the desired scenario.
|
||||||
Because the "Decrypt-BitlockerVolume" command is asynchronous, a Do-Until loop will be used in order to track the decrpytion process on each volume and keep the script from exiting until the decryption is completed.
|
Because the "Decrypt-BitlockerVolume" command is asynchronous, a Do-Until loop will be used in order to track the decrpytion process on each volume and keep the script from exiting until the decryption is completed.
|
||||||
|
|
||||||
.PARAMETER DriveTypeExpression
|
.PARAMETER DriveTypeExpression
|
||||||
A regular expression that correctly includes values from the "DriveType" property as seen in the example below.
|
A regular expression that correctly includes values from the "DriveType" property as seen in the example below.
|
||||||
|
|
||||||
DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining Size
|
DriveLetter FriendlyName FileSystemType DriveType HealthStatus OperationalStatus SizeRemaining Size
|
||||||
----------- ------------ -------------- --------- ------------ ----------------- ------------- ----
|
----------- ------------ -------------- --------- ------------ ----------------- ------------- ----
|
||||||
C OS NTFS Fixed Healthy OK 164.69 GB 475.69 GB
|
C OS NTFS Fixed Healthy OK 164.69 GB 475.69 GB
|
||||||
WinRE_DRV NTFS Fixed Healthy OK 503.32 MB 1000 MB
|
WinRE_DRV NTFS Fixed Healthy OK 503.32 MB 1000 MB
|
||||||
SYSTEM FAT32 Fixed Healthy OK 225.49 MB 256 MB
|
SYSTEM FAT32 Fixed Healthy OK 225.49 MB 256 MB
|
||||||
|
|
||||||
.PARAMETER DriveLetterInclusionExpression
|
.PARAMETER DriveLetterInclusionExpression
|
||||||
A regular expression that correctly includes the desired drive letters of encrypted volumes. By default, only the operating system volume is included.
|
A regular expression that correctly includes the desired drive letters of encrypted volumes. By default, only the operating system volume is included.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
All Volumes - ^[a-zA-Z]$
|
All Volumes - ^[a-zA-Z]$
|
||||||
Specific Volumes - ^[C]$
|
Specific Volumes - ^[C]$
|
||||||
Multiple Volumes - ^[E|H|K]$
|
Multiple Volumes - ^[E|H|K]$
|
||||||
|
|
||||||
.PARAMETER DriveLetterExclusionExpression
|
.PARAMETER DriveLetterExclusionExpression
|
||||||
A regular expression that correctly excludes the desired drive letters of encrypted volumes. By default, only volumes without a drive letter are excluded.
|
A regular expression that correctly excludes the desired drive letters of encrypted volumes. By default, only volumes without a drive letter are excluded.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
Specific Volumes - ^[C]$
|
Specific Volumes - ^[C]$
|
||||||
Multiple Volumes - ^[E|H|K]$
|
Multiple Volumes - ^[E|H|K]$
|
||||||
|
|
||||||
.PARAMETER VolumeStatusExpression
|
.PARAMETER VolumeStatusExpression
|
||||||
A regular expression that correctly includes the bitlocker volume status of an encryptable volume.
|
A regular expression that correctly includes the bitlocker volume status of an encryptable volume.
|
||||||
|
|
||||||
VolumeType Mount CapacityGB VolumeStatus Encryption KeyProtector AutoUnlock Protection
|
VolumeType Mount CapacityGB VolumeStatus Encryption KeyProtector AutoUnlock Protection
|
||||||
Point Percentage Enabled Status
|
Point Percentage Enabled Status
|
||||||
---------- ----- ---------- ------------ ---------- ------------ ---------- ----------
|
---------- ----- ---------- ------------ ---------- ------------ ---------- ----------
|
||||||
OperatingSystem C: 475.69 FullyDecrypted 0 {} Off
|
OperatingSystem C: 475.69 FullyDecrypted 0 {} Off
|
||||||
|
|
||||||
.PARAMETER DebugMode
|
.PARAMETER DebugMode
|
||||||
Allows for the testing of this scripts functionality, but not actually perform volume decryption.
|
Allows for the testing of this scripts functionality, but not actually perform volume decryption.
|
||||||
|
|
||||||
.PARAMETER LogDir
|
.PARAMETER LogDir
|
||||||
A valid folder path. If the folder does not exist, it will be created. This parameter can also be specified by the alias "LogPath".
|
A valid folder path. If the folder does not exist, it will be created. This parameter can also be specified by the alias "LogPath".
|
||||||
|
|
||||||
.PARAMETER ContinueOnError
|
.PARAMETER ContinueOnError
|
||||||
Ignore failures.
|
Ignore failures.
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -File "%FolderPathContainingScript%\%ScriptName%.ps1"
|
powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -File "%FolderPathContainingScript%\%ScriptName%.ps1"
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -File "%FolderPathContainingScript%\%ScriptName%.ps1" -ScriptParameter "%ScriptParameterValue%"
|
powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -File "%FolderPathContainingScript%\%ScriptName%.ps1" -ScriptParameter "%ScriptParameterValue%"
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -File "%FolderPathContainingScript%\%ScriptName%.ps1" -SwitchParameter
|
powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -File "%FolderPathContainingScript%\%ScriptName%.ps1" -SwitchParameter
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
The Disable-BitLocker cmdlet disables BitLocker Drive Encryption for a BitLocker volume. When you run this cmdlet, it removes all key protectors and begins decrypting the content of the volume.
|
The Disable-BitLocker cmdlet disables BitLocker Drive Encryption for a BitLocker volume. When you run this cmdlet, it removes all key protectors and begins decrypting the content of the volume.
|
||||||
|
|
||||||
If the volume that hosts the operating system contains any automatic unlocking keys, the cmdlet does not proceed. You can use the Clear-BitLockerAutoUnlock cmdlet to remove all automatic unlocking keys. Then you can disable BitLocker for the volume.
|
If the volume that hosts the operating system contains any automatic unlocking keys, the cmdlet does not proceed. You can use the Clear-BitLockerAutoUnlock cmdlet to remove all automatic unlocking keys. Then you can disable BitLocker for the volume.
|
||||||
|
|
||||||
For an overview of BitLocker, see BitLocker Drive Encryption Overview on TechNet.
|
For an overview of BitLocker, see BitLocker Drive Encryption Overview on TechNet.
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://docs.microsoft.com/en-us/powershell/module/bitlocker/disable-bitlocker?view=windowsserver2019-ps
|
https://docs.microsoft.com/en-us/powershell/module/bitlocker/disable-bitlocker?view=windowsserver2019-ps
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
[Regex]$VolumeStatusExpression = "^FullyDecrypted$",
|
[Regex]$VolumeStatusExpression = "^FullyDecrypted$",
|
||||||
|
|
||||||
[Parameter(Mandatory=$False)]
|
[Parameter(Mandatory=$False)]
|
||||||
[Switch]$DebugMode = $True,
|
[Switch]$DebugMode,
|
||||||
|
|
||||||
[Parameter(Mandatory=$False)]
|
[Parameter(Mandatory=$False)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
@@ -293,8 +293,8 @@ Else
|
|||||||
|
|
||||||
$ErrorMessage = "[Error Message: $($ExceptionMessage)][ScriptName: $($_.InvocationInfo.ScriptName)][Line Number: $($_.InvocationInfo.ScriptLineNumber)][Line Position: $($_.InvocationInfo.OffsetInLine)][Code: $($_.InvocationInfo.Line.Trim())]`r`n"
|
$ErrorMessage = "[Error Message: $($ExceptionMessage)][ScriptName: $($_.InvocationInfo.ScriptName)][Line Number: $($_.InvocationInfo.ScriptLineNumber)][Line Position: $($_.InvocationInfo.OffsetInLine)][Code: $($_.InvocationInfo.Line.Trim())]`r`n"
|
||||||
Write-Error -Message "$($ErrorMessage)"
|
Write-Error -Message "$($ErrorMessage)"
|
||||||
}
|
}
|
||||||
|
|
||||||
#Log any useful information
|
#Log any useful information
|
||||||
[String]$CmdletName = $MyInvocation.MyCommand.Name
|
[String]$CmdletName = $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
@@ -788,4 +788,4 @@ Else
|
|||||||
Stop-Transcript -Verbose
|
Stop-Transcript -Verbose
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user