Decrypt Drive Then Wait Till Complete

I need to decrypt the D drive on devices performing a REFRESH task sequence. It is one thing to decrypt it, and another to wait till it has finished. This script will wait till the whole drive is decrypted.

I modified the PowerShell script from scconfigmgr.com and it preformed perfectly.

Find and replace the C: with the drive letter. Then add into the task sequence.

Here is the script in case the page disappears:

$ComputerName = “.”
$BitLockerDrive = Get-Wmiobject -Namespace root\CIMv2\Security\MicrosoftVolumeEncryption -Class Win32_EncryptableVolume -ComputerName $ComputerName -Filter “DriveLetter=’C:'”
$Status = $BitLockerDrive.GetConversionStatus()
if ($Status.ConversionStatus -eq 0) {
    {Exit}
}
elseif ($Status.ConversionStatus -eq 1) {
    Invoke-Command {manage-bde.exe -off C:}
    cls
    Start-Sleep 3
    do {
        $BitLockerDrive = Get-Wmiobject -Namespace root\CIMv2\Security\MicrosoftVolumeEncryption -Class Win32_EncryptableVolume -ComputerName $ComputerName -Filter “DriveLetter=’C:'”
        $Status = $BitLockerDrive.GetConversionStatus()
        Start-Sleep 15
    }
    until ($Status.ConversionStatus -eq 0)
}
if ($Status.ConversionStatus -eq 0) {
    {Exit}
}
Advertisements