Skip to content

Commit d536e1c

Browse files
committed
Init Enable-BitLocker
See SYNOPSIS/DESCRIPTION
1 parent 3b3b6dd commit d536e1c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

ps-cryptography/Enable-BitLocker.ps1

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Function Enable-BitLocker {
2+
<#
3+
.SYNOPSIS
4+
Enables BitLocker on the specified drive.
5+
6+
.DESCRIPTION
7+
This function enables BitLocker encryption on the specified drive, it checks the current status of BitLocker on the drive and if it's not enabled, it proceeds to enable BitLocker.
8+
9+
.PARAMETER MountPoint
10+
Mandatory - the drive letter or mount point for which BitLocker will be enabled.
11+
12+
.EXAMPLE
13+
Enable-BitLocker -MountPoint "C:"
14+
15+
.NOTES
16+
v0.0.1
17+
#>
18+
[CmdletBinding()]
19+
param (
20+
[Parameter(Mandatory = $true)]
21+
[string]$MountPoint
22+
)
23+
$DriveInfo = Get-BitLockerVolume -MountPoint $MountPoint
24+
if ($DriveInfo.ProtectionStatus -eq "Off") {
25+
Enable-BitLocker -MountPoint $MountPoint -Verbose
26+
Write-Host "BitLocker has been enabled on drive $MountPoint" -ForegroundColor Green
27+
}
28+
else {
29+
Write-Host "BitLocker is already enabled on drive $MountPoint" -ForegroundColor Yellow
30+
}
31+
}

0 commit comments

Comments
 (0)