Jump to content

Returning data from a COM object into a parameterized string array

Recommended Posts

I have a Win32_EncryptableVolume COM object in AutoIt that takes a parameter on the GetKeyProtectors method of a string array that the method needs to write the results into. Is this possible to do? If so, how?

More explicitly,
I am using WMI to obtain a COM object from Win32_EncryptableVolume (from the \\.\root\cimv2\Security\MicrosoftVolumeEncryption namespace). I end up with a COM object variable. I can access the various Win32_EncryptableVolume properties and methods. This part works great.

However, what I really want to use is the GetKeyProtectors method. This takes an int protector type (in my case at the moment I really only want #3 for the 'numeric password') and a string array that it will write the results into. That is, GetKeyProtectors( in int KeyProtectorType = 3, out string VolumeKeyProtectorID[] ) or,

$Win32_EncryptableVolume_object.GetKeyProtectors(3, $array_to_receive_data)

So, I need to pass in a string array that will receive the results as the second parameter. Is this possible to do? If so, how?

I've tried passing in an array and it doesn't receive the data. I've tried using DllCreateStruct unsuccessfully. I found some various websites and forums with information that seems relevant but isn't exactly what I need so they didn't end up working out. At this point I'm flailing so I'm hoping someone here understands.

Or if there's another way to discover key protectors then that would be helpful too. I could parse output from manage-bde.exe, but I'd much prefer to do it with COM. My end goal is to obtain the numerical password with the GetKeyProtectorNumericalPassword method, but I need to know the volume's unique protector ID.

Thank you for whatever help you can provide and let me know if you need anything else from me. ^_^

Link to post
Share on other sites

Try this:

Local $array_to_receive_data
$Win32_EncryptableVolume_object.GetKeyProtectors(3, $array_to_receive_data)

For $objId in $array_to_receive_data
    Local $VolumeKeyProtectorFriendlyName
    $objId.GetKeyProtectorFriendlyName $objId, $VolumeKeyProtectorFriendlyName
    If $VolumeKeyProtectorFriendlyName <> "" Then
        ConsoleWrite( "KeyProtectors: " & $VolumeKeyProtectorFriendlyName & @CRLF)
    End If

Also, if you google VBS examples for any given COM object, it's easy to translate into autoit:



Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...