.net - WMI + Bitlocker + C# Get encrypted Volumes produces timeout -
i want create wrapper class specific wmi functions affect bitlocker functionality. first step bitlocker volumes of machine created console application , did this:
private static managementclass management; private static managementobjectcollection volumes = null; static void main(string[] args) { managementpath path = new managementpath(); path.server = ""; path.namespacepath = "\\root\\cimv2\\security\\microsoftvolumeencryption"; path.classname = "win32_encryptablevolume"; connectionoptions options = new connectionoptions(); options.authentication = authenticationlevel.packetprivacy; options.impersonation = impersonationlevel.impersonate; managementscope scope = new managementscope(path, options); objectgetoptions getoptions = new objectgetoptions(); management = new managementclass(scope, path, getoptions); management.get(); volumes = management.getinstances(); }
when run on non-bitlocker machine volumes collection gets initialized ok, has count of 0 of course. copied code on winforms app , when click button run code steps through ok when try expand collection during debugging app hangs , "function evaluation timed out". it's same code in application. reason this?
hm. got null reference exception if didn't run administrator, when ran administrator (win 7 x64, btw), got 4 volumes back.
Comments
Post a Comment