-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDecryptAndWait.ps1
More file actions
36 lines (35 loc) · 1.54 KB
/
Copy pathDecryptAndWait.ps1
File metadata and controls
36 lines (35 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ***************************************************************************
#
# Purpose: Decrypts Specified Drive and waits for completion
#
# ------------- DISCLAIMER -------------------------------------------------
# This script code is provided as is with no guarantee or waranty concerning
# the usability or impact on systems and may be used, distributed, and
# modified in any way provided the parties agree and acknowledge the
# Microsoft or Microsoft Partners have neither accountabilty or
# responsibility for results produced by use of this script.
#
# Microsoft will not provide any support through any means.
# ------------- DISCLAIMER -------------------------------------------------
#
# ***************************************************************************
$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:}
Clear-Host
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}
}