BitLocker Initialization - Detection
Description
Checks whether the BitLocker state of a Windows device matches the configuration in the cPVAL custom fields, without changing anything. It is the condition of the Enable BitLocker - Laptop, Enable BitLocker - Desktop and Enable BitLocker - Server compound conditions. When it exits with 1, the compound condition runs Initialize and Audit BitLocker. The checks follow the same order as that automation, so it only runs when there is something to fix.
Exit Code 0: No Action Needed
- The drive is decrypting, or decryption is paused.
- BitLocker is waiting for the hardware test at the next restart.
- Protection is suspended for a set number of restarts, as BIOS and firmware updates do.
- Encryption is in progress, or the drive matches the configuration with protection on.
Exit Code 1: Initialize and Audit BitLocker Must Run
The output contains a line that begins with Detected: and gives the reason.
- BitLocker is not enabled.
- The system drive has key protectors, but none that can unlock it at startup (no TPM based or password protector), while the configured protector is
RecoveryPassword,RecoveryKeyorAdAccount. These devices ask for the recovery key at every startup while protection is on. This is checked even while encryption is in progress. - The drive uses a different TPM based protector or encryption method than configured. This is not flagged while encryption is in progress.
- The drive is encrypted without key protectors (Windows device encryption waiting for activation).
- The configured protector, or the recovery password set in cPVAL PIN Or Password, is missing.
- Encryption is paused, or protection is suspended until it is resumed manually.
Exit Code 2: Unsupported or Needs Attention
The output contains a line that begins with [FAIL] and gives the reason. Initialize and Audit BitLocker does not run.
- The BitLocker module is missing, or the device runs a Home edition.
- A value the key protector needs is missing, or cPVAL PIN Or Password is not a valid 48-digit recovery password while the key protector is
RecoveryPassword. - The drive cannot be read.
- The BitLocker hardware test failed and cPVAL SkipHardwareTest is not checked.
- The fix needs a TPM and none was found, or the TPM is not ready and cPVAL Allow TPM Or Reboot does not allow initializing it.
- The fix would decrypt and encrypt the drive again, and the TPM it needs is not ready.
Sample Run
Manual execution of this script is not recommended. It is designed to run as the condition of the solution's compound conditions.
Dependencies
- Custom Field - cPVAL MountPoint
- Custom Field - cPVAL EncryptionMethod
- Custom Field - cPVAL KeyProtectorType
- Custom Field - cPVAL PIN Or Password
- Custom Field - cPVAL Path Or ADAccount
- Custom Field - cPVAL Allow TPM Or Reboot
- Custom Field - cPVAL SkipHardwareTest
- Automation - Initialize and Audit BitLocker
- Solution - BitLocker Initialize - NinjaOne
Custom Fields
| Field Label | Scope | Accepted Values | Default Value | Description |
|---|---|---|---|---|
| cPVAL MountPoint | Organization, Location, Device | A drive letter: D, D: or D:\ | System drive | The drive to check. |
| cPVAL EncryptionMethod | Organization, Location, Device | Aes128, Aes256, XtsAes128, XtsAes256 | XtsAes128 | The expected encryption method. |
| cPVAL KeyProtectorType | Organization, Location, Device | Tpm, TpmPin, TpmStartup, TpmPinStartup, Password, Startup, RecoveryKey, RecoveryPassword, AdAccount | RecoveryPassword | The expected key protector. |
| cPVAL PIN Or Password | Organization, Location, Device | A PIN, a password, or a 48-digit recovery password | - | Checked for presence, and for the recovery password format with RecoveryPassword. |
| cPVAL Path Or ADAccount | Organization, Location, Device | A folder path, or a domain account or group | - | Checked for presence when the key protector needs it. |
| cPVAL Allow TPM Or Reboot | Organization, Location, Device | 0, 1, 2, 3 | 0 | Decides whether a TPM that is not ready can be initialized by the fix. |
| cPVAL SkipHardwareTest | Organization, Location, Device | Checked or unchecked | Unchecked | Decides whether a failed hardware test blocks the fix. |
Automation Setup/Import
Output
- Activity Logs
Changelog
2026-10-26
- Documented the updated detection logic and the output of each exit code. Exit 1 now writes a line that begins with
Detected:. - Added detection of system drives that have no key protector able to unlock them at startup, and of Windows device encryption waiting for activation.
- The script now exits with 2 instead of starting a fix that needs a TPM that is missing or not ready.
- Removed the Force parameter, which belongs to Initialize and Audit BitLocker.
- Corrected the custom field values and the cPVAL SkipHardwareTest link text.
2025-12-30
- Initial version of the document