Hi,
Atleast some progress, now I am able to have some results with help of following code:
But I would like to check ONLY if C:\ drive is encrypted then show a message box. Otherwise /IF not encrypted, show form2.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Try
Me.RichTextBox1.Clear()
Dim searcher As New ManagementObjectSearcher("root\cimv2\Security\MicrosoftVolumeEncryption", "SELECT * FROM Win32_EncryptableVolume")
For Each queryObj As ManagementObject In searcher.Get()
'
queryObj("DriveLetter").ToString.ToUpper()
queryObj("ProtectionStatus").ToString.ToUpper()
Dim drvLtr = "C:"
Dim prtStatus = "1"
'
If queryObj("DriveLetter").ToString.ToUpper.Contains(drvLtr.ToUpper) AndAlso queryObj("ProtectionStatus").ToString.ToUpper.Contains(prtStatus.ToUpper) Then
MessageBox.Show(queryObj("DriveLetter").ToString & "Drive is Encrypted.") 'Concludes C:\ is encrypted
Else 'Otherwise assume C:\ is not encrypted.
MessageBox.Show(queryObj("DriveLetter").ToString & "Drive is NOT Accessible.")
End If
'
Next
Catch err As ManagementException
Me.Text = "An error occurred while querying for WMI data: " & err.Message
End Try
End Sub
But it seems like all drives are being evaluated and false results generated in messagebox.
Any thought to limit it to scan for C:\ drive ONLY?
Code Credits: how-to-get-the-result-of-a-getproperties-method-of-a-wmi-class-in-vbnet-using