EDN Admin
Well-known member
Connects to the remote PLT
Set objWMIService1 = GetObject( "winmgmts:" _
& "{authenticationLevel=pktPrivacy}!\" _
& strPLT _
& "rootCIMV2SecurityMicrosoftVolumeEncryption")
Set colItems1 = objWMIService1.ExecQuery("SELECT * FROM Win32_EncryptableVolume",,48)
Dim arEncryptionMethod
arEncryptionMethod = Array( "None", "AES 128 With Diffuser", "AES 256 With Diffuser", "AES 128", "AES 256" )
Dim arProtectionStatus
arProtectionStatus = Array( "Protection Off", "Protection On", "Protection Unknown" )
Dim arConversionStatus
arConversionStatus = Array( "Fully Decrypted", "Fully Encrypted", "Encryption In Progress", "Decryption In Progress", "Encryption Paused", "Decryption Paused" )
Dim arLockStatus
arLockStatus = Array( "Unlocked", "Locked" )
Gets the Operating system of the PLT
OSReturn = GetOS(strPLT)
Gets the BDE Status
For Each objItem1 in colItems1
GetBDEStatus = "Success"
Dim EncryptionMethod
Dim ProtectionStatus
Dim ConversionStatus
Dim EncryptionPercentage
Dim VolumeKeyProtectorID
Dim LockStatus
Dim completeVolumeKeyProtectorFriendlyName
objItem1.GetEncryptionMethod EncryptionMethod
objItem1.GetProtectionStatus ProtectionStatus
objItem1.GetConversionStatus ConversionStatus, EncryptionPercentage
objItem1.GetKeyProtectors 0,VolumeKeyProtectorID
objItem1.GetLockStatus LockStatus
Writes in the Log file
wscript.echo "DeviceID: " & objItem1.DeviceID
wscript.echo "DriveLetter: " & objItem1.DriveLetter
wscript.echo "EncryptionMethod: " & arEncryptionMethod(EncryptionMethod) & " (" & EncryptionMethod & ")"
wscript.echo "ProtectionStatus: " & arProtectionStatus(ProtectionStatus) & " (" & ProtectionStatus & ")"
wscript.echo "ConversionStatus: " & arConversionStatus(ConversionStatus) & " (" & ConversionStatus & ")"
wscript.echo "EncryptionPercentage: " & EncryptionPercentage & "%"
wscript.echo "LockStatus: " & arLockStatus(LockStatus) & " (" & LockStatus & ")"
completeVolumeKeyProtectorFriendlyName = ""
For Each objId in VolumeKeyProtectorID
Dim VolumeKeyProtectorFriendlyName
objItem1.GetKeyProtectorFriendlyName objId, VolumeKeyProtectorFriendlyName
If VolumeKeyProtectorFriendlyName <> "" Then
wscript.echo " KeyProtectors: " & VolumeKeyProtectorFriendlyName
completeVolumeKeyProtectorFriendlyName = completeVolumeKeyProtectorFriendlyName & "/" & VolumeKeyProtectorFriendlyName
End If
Next
Next
Please find the code above, which i was able to run in vbscirpt, but when i tried to move this code in vb.net i was not able to get the result for EncryptionMethod, EncryptionPercentage etc.
Please help.
Vineet Verma
View the full article
Set objWMIService1 = GetObject( "winmgmts:" _
& "{authenticationLevel=pktPrivacy}!\" _
& strPLT _
& "rootCIMV2SecurityMicrosoftVolumeEncryption")
Set colItems1 = objWMIService1.ExecQuery("SELECT * FROM Win32_EncryptableVolume",,48)
Dim arEncryptionMethod
arEncryptionMethod = Array( "None", "AES 128 With Diffuser", "AES 256 With Diffuser", "AES 128", "AES 256" )
Dim arProtectionStatus
arProtectionStatus = Array( "Protection Off", "Protection On", "Protection Unknown" )
Dim arConversionStatus
arConversionStatus = Array( "Fully Decrypted", "Fully Encrypted", "Encryption In Progress", "Decryption In Progress", "Encryption Paused", "Decryption Paused" )
Dim arLockStatus
arLockStatus = Array( "Unlocked", "Locked" )
Gets the Operating system of the PLT
OSReturn = GetOS(strPLT)
Gets the BDE Status
For Each objItem1 in colItems1
GetBDEStatus = "Success"
Dim EncryptionMethod
Dim ProtectionStatus
Dim ConversionStatus
Dim EncryptionPercentage
Dim VolumeKeyProtectorID
Dim LockStatus
Dim completeVolumeKeyProtectorFriendlyName
objItem1.GetEncryptionMethod EncryptionMethod
objItem1.GetProtectionStatus ProtectionStatus
objItem1.GetConversionStatus ConversionStatus, EncryptionPercentage
objItem1.GetKeyProtectors 0,VolumeKeyProtectorID
objItem1.GetLockStatus LockStatus
Writes in the Log file
wscript.echo "DeviceID: " & objItem1.DeviceID
wscript.echo "DriveLetter: " & objItem1.DriveLetter
wscript.echo "EncryptionMethod: " & arEncryptionMethod(EncryptionMethod) & " (" & EncryptionMethod & ")"
wscript.echo "ProtectionStatus: " & arProtectionStatus(ProtectionStatus) & " (" & ProtectionStatus & ")"
wscript.echo "ConversionStatus: " & arConversionStatus(ConversionStatus) & " (" & ConversionStatus & ")"
wscript.echo "EncryptionPercentage: " & EncryptionPercentage & "%"
wscript.echo "LockStatus: " & arLockStatus(LockStatus) & " (" & LockStatus & ")"
completeVolumeKeyProtectorFriendlyName = ""
For Each objId in VolumeKeyProtectorID
Dim VolumeKeyProtectorFriendlyName
objItem1.GetKeyProtectorFriendlyName objId, VolumeKeyProtectorFriendlyName
If VolumeKeyProtectorFriendlyName <> "" Then
wscript.echo " KeyProtectors: " & VolumeKeyProtectorFriendlyName
completeVolumeKeyProtectorFriendlyName = completeVolumeKeyProtectorFriendlyName & "/" & VolumeKeyProtectorFriendlyName
End If
Next
Next
Please find the code above, which i was able to run in vbscirpt, but when i tried to move this code in vb.net i was not able to get the result for EncryptionMethod, EncryptionPercentage etc.
Please help.
Vineet Verma
View the full article