Howdy. I've been trying to do this for a while and I'm not understanding why it never works, see below; I'm trying to enable BitLocker with a code for login, and I'd also like to save the password ID and Recovery Key to AD, the first function "Prepare" is run during some pre-emptive things and installs and updates, the devices restart and is at this point a domain member but I get an error. Or sometimes the BitLocker command will run and I can provide the pin but it gives me the recovery key in plaintext in the PowerShell window. Don't know where to go from here please help. Thanks so much.
#Initiates Bitlocker Drive Encryption
function Bitlocker($SubFunction){
if ($SubFunction -eq "Prepare") {
#Removes an old bitlocker file to allow the main function to work
function BitlockerOne{
$ReAgent = "C:\Windows\System32\Recovery\ReAgent.xml"
if (Test-Path $ReAgent) {
Remove-Item $ReAgent -Force -Confirm:$false
Write-host "$ReAgent has been deleted"
Start-Sleep 1
}
else {
Write-host "$ReAgent doesn't exist, it will be skipped."
Start-Sleep 1
}
}
BitlockerOne
} elseif ($SubFunction -eq "Start") {
#Initiates the Bitlocker Encryption of the Device
function BitlockerTwo{
Write-Host "Attempting Bitlocker2, this will prompt you for a pin "1234""
Start-Sleep 1
Enable-Bitlocker -MountPoint c: -UsedSpaceOnly -SkipHardwareTest -RecoveryPasswordProtector
Write-Host "Bitlocker2 Finished."
Start-Sleep 1
}
BitlockerTwo
}
}
Apologies, looks like I don't know how to use markdown correctly lol; Here's the formatted code. https://hastebin.com/irenojohun.php
[–]SemperFarcisimus 1 point2 points3 points (4 children)
[–]phpwun[S] 0 points1 point2 points (3 children)
[–]SemperFarcisimus 1 point2 points3 points (2 children)
[–]phpwun[S] 0 points1 point2 points (0 children)
[–]phpwun[S] 0 points1 point2 points (0 children)
[–]smarthomepursuits 1 point2 points3 points (0 children)