const
WbemUser = '
';
WbemPassword = '
';
WbemComputer = '
localhost';
wbemFlagForwardOnly = $00000020;
var
FSWbemLocator,
FWMIService,
FWbemObjectSet,
FWbemObject: OLEVariant;
oEnum: IEnumvariant;
iValue: LongWord;
begin;
FSWbemLocator := CreateOleObject('
WbemScripting.SWbemLocator');
FWMIService := FSWbemLocator.ConnectServer(WbemComputer, '
root\CIMV2\Security\MicrosoftVolumeEncryption', WbemUser, WbemPassword);
FWbemObjectSet := FWMIService.ExecQuery('
SELECT * FROM Win32_EncryptableVolume where DRIVELETTER=''
C:''
', '
WQL', wbemFlagForwardOnly);
oEnum := IUnknown(FWbemObjectSet._NewEnum)
as IEnumVariant;
while oEnum.Next(1, FWbemObject, iValue) = 0
do
begin
memo1.lines.add(Format('
ConversionStatus %d',[Integer(FWbemObject.ConversionStatus)]));
memo1.lines.add(Format('
DriveLetter %s',[
String(FWbemObject.DriveLetter)]));
memo1.lines.add(Format('
EncryptionMethod %d',[Integer(FWbemObject.EncryptionMethod)]));
memo1.lines.add(Format('
IsVolumeInitializedForProtection %s',[
String(FWbemObject.IsVolumeInitializedForProtection)]));
memo1.lines.add(Format('
PersistentVolumeID %s',[
String(FWbemObject.PersistentVolumeID)]));
memo1.lines.add(Format('
ProtectionStatus %d',[Integer(FWbemObject.ProtectionStatus)]));
memo1.lines.add(Format('
VolumeType %d',[Integer(FWbemObject.VolumeType)]));
FWbemObject:=Unassigned;
end;