Wrong BitLocker Status Retrieval for Encrypted USB Drive Using WMI in C#

I’m trying to retrieve the BitLocker status of a USB drive using WMI in C#. I have written the following code to determine the protection status, conversion status, and encryption method of the drive. The code works well for a non-BitLocker protected USB drive but returns wrong results for a BitLocker-protected USB drive. Here is my code:

private static void CheckBitLockerStatus(string driveLetter){
try {
    
    var scope = new ManagementScope(@"\.rootCIMV2SecurityMicrosoftVolumeEncryption");
    scope.Connect();

    var query = new ObjectQuery($"SELECT * FROM Win32_EncryptableVolume WHERE DriveLetter = '{driveLetter}'");
    var searcher = new ManagementObjectSearcher(scope, query);
    var volumes = searcher.Get();

    if (volumes.Count == 0) {
        Console.WriteLine($"No BitLocker information found for drive {driveLetter}.");
        return;
    }

    foreach (ManagementObject volume in volumes) {
        
        ManagementBaseObject protectionStatusParams = volume.InvokeMethod("GetProtectionStatus", null, null);
        uint protectionStatus = (uint)protectionStatusParams["ProtectionStatus"];

        ManagementBaseObject conversionStatusParams = volume.InvokeMethod("GetConversionStatus", null, null);
        uint conversionStatus = (uint)conversionStatusParams["ConversionStatus"];

        ManagementBaseObject encryptionMethodParams = volume.InvokeMethod("GetEncryptionMethod", null, null);
        uint encryptionMethod = (uint)encryptionMethodParams["EncryptionMethod"];

        string protectionStatusDescription;
        if (protectionStatus == 0)
            protectionStatusDescription = "Protection is Off";
        else if (protectionStatus == 1)
            protectionStatusDescription = "Protection is On";
        else if (protectionStatus == 2)
            protectionStatusDescription = "Protection is Unknown";
        else
            protectionStatusDescription = "Unknown Protection Status";

        string conversionStatusDescription;
        if (conversionStatus == 0)
            conversionStatusDescription = "Fully Decrypted";
        else if (conversionStatus == 1)
            conversionStatusDescription = "Fully Encrypted";
        else if (conversionStatus == 2)
            conversionStatusDescription = "Encryption In Progress";
        else if (conversionStatus == 3)
            conversionStatusDescription = "Decryption In Progress";
        else if (conversionStatus == 4)
            conversionStatusDescription = "Encryption Paused";
        else if (conversionStatus == 5)
            conversionStatusDescription = "Decryption Paused";
        else
            conversionStatusDescription = "Unknown Conversion Status"; 

        string encryptionMethodDescription;
        if (encryptionMethod == 0)
            encryptionMethodDescription = "None";
        else if (encryptionMethod == 1)
            encryptionMethodDescription = "AES 128-bit with Diffuser";
        else if (encryptionMethod == 2)
            encryptionMethodDescription = "AES 256-bit with Diffuser";
        else if (encryptionMethod == 3)
            encryptionMethodDescription = "AES 128-bit";
        else if (encryptionMethod == 4)
            encryptionMethodDescription = "AES 256-bit";
        else
            encryptionMethodDescription = "Unknown Encryption Method";

        Console.WriteLine($"Drive: {driveLetter}");
        Console.WriteLine($"Protection Status: {protectionStatusDescription}");
        Console.WriteLine($"Conversion Status: {conversionStatusDescription}");
        Console.WriteLine($"Encryption Method: {encryptionMethodDescription}");

        ManagementBaseObject keyProtectorsParams = volume.InvokeMethod("GetKeyProtectors", null, null);
        string[] keyProtectorIDs = (string[])keyProtectorsParams["VolumeKeyProtectorID"];

        if (keyProtectorIDs != null && keyProtectorIDs.Length > 0) {
            Console.WriteLine($"BitLocker is configured on drive {driveLetter} with key protectors.");
        }
        else {
            Console.WriteLine($"No key protectors found on drive {driveLetter}. BitLocker might not be configured.");
        }

        if (protectionStatus == 0 && conversionStatus != 1) {
            Console.WriteLine($"BitLocker is configured but not actively protecting the drive {driveLetter}.");
        }
        else if (protectionStatus == 1) {
            Console.WriteLine($"BitLocker is actively protecting the drive {driveLetter}.");
        }
        else {
            Console.WriteLine($"BitLocker status for drive {driveLetter} could not be determined.");
        }
    }
}
catch (ManagementException ex) {
    Console.WriteLine("A WMI error occurred: " + ex.Message);
}
catch (UnauthorizedAccessException ex) {
    Console.WriteLine("You do not have the required permissions to perform this operation: " + ex.Message);
}
catch (Exception ex) {
    Console.WriteLine("An unexpected error occurred: " + ex.Message);
} }

When I run this code for a BitLocker-protected but decrypted USB drive, I get the following output:

Drive: F:

  1. Protection Status: Protection is Off
  2. Conversion Status: Encryption In Progress
  3. Encryption Method: Unknown Encryption Method

My Questions:

  1. Why does the GetProtectionStatus method return “Protection is Off” while GetConversionStatus returns “Encryption In Progress” even though nothing is in progress?
  2. Why is the GetEncryptionMethod returning “Unknown Encryption Method”?
  3. How can I correctly determine the BitLocker status of the USB drive, especially when it has been decrypted?

Any insights or suggestions on how to resolve these inconsistencies would be greatly appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật