关闭bitlocker
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$form = New-Object System.Windows.Forms.Form
$form.Text = "达人bitlock关闭工具"
$form.Size = New-Object System.Drawing.Size(300,150)
$form.StartPosition = "CenterScreen"
$button = New-Object System.Windows.Forms.Button
$button.Location = New-Object System.Drawing.Point(75,50)
$button.Size = New-Object System.Drawing.Size(150,30)
$button.Text = "解密所有BitLocker"
$button.Add_Click({
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
[System.Windows.Forms.MessageBox]::Show("请以管理员身份运行此程序!", "错误", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Error)
return
}
$drives = manage-bde -status | Where-Object { $_ -match "卷\s+\w:" -and $_ -match "已加密" } | ForEach-Object { $_ -replace ".*卷\s+(\w:).*", '$1' }
if ($drives.Count -eq 0) {
[System.Windows.Forms.MessageBox]::Show("未找到BitLocker加密的驱动器", "信息", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
return
}
foreach ($drive in $drives) {
Start-Process -FilePath "manage-bde" -ArgumentList "-off $drive" -NoNewWindow -Wait
}
[System.Windows.Forms.MessageBox]::Show("所有BitLocker加密驱动器已开始解密!`n解密过程可能需要较长时间。", "完成", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)
})
$form.Controls.Add($button)
$form.ShowDialog() | Out-Null管理员身份运行终端 贴入