Abhishek Kandoi
Abhishek Kandoi

Reputation: 11

Is there any way to open BitLocker on Windows10 OS drive(C:) automatically on StartUp that is running on XenOrchestra vm machine?

I am currently using the Windows 10 on XenOrchestra VM. I have BitLocker password setup on Windows 10 OS so I have to manually put in password every time I restart the VM. This VM is also used by other people also and they don't have access to the password. I have to automate this process. The BitLocker is on OS drive(i.e. C:). Can this automation be achieved by any script on boot up or using the XenOrchestra API. I want to do it as soon as machine boots up not on user login. I have bitlocker installed without TPM.

I have already tried a powershell script given below:-

$BitLockerPassword = ConvertTo-SecureString "MYPASSWORD" -AsPlainText -Force

# Replace 'C:' with the drive letter of the BitLocker-protected drive you want to unlock
$DriveLetter = 'C:'

# Check if BitLocker is enabled on the specified drive
$BitLockerStatus = (Get-BitLockerVolume -MountPoint $DriveLetter).ProtectionStatus

if ($BitLockerStatus -eq 'On') {
    # Attempt to unlock the drive using the provided password
    $UnlockResult = Unlock-BitLocker -MountPoint $DriveLetter -Password $BitLockerPassword

    # echo $UnlockResult

    if ($UnlockResult.mountpoint -eq 'C:') {
        Write-Host "BitLocker drive unlocked successfully!"
    } else {
        Write-Host "Failed to unlock the BitLocker drive. Check the password and try again."
    }
}

I have tried putting it in shell:startup. It just opens the file when I log in. I have also tried using a .cmd file that also works after log in. I have tried in gpedit.msc Startup script as well but it isn't working. I also tried Task Schedule that also isn't working.

I am new to this so please bear with me if I left any important detail.

Upvotes: 1

Views: 61

Answers (0)

Related Questions