Following this question, I want to list all the methods and properties exposed by a Component Object Model (COM)
object, given its ProgID
. From here I can list all the COM object ProgIDs available from the registry:
dir REGISTRY::HKEY_CLASSES_ROOT\CLSID -include PROGID -recurse | foreach {$_.GetValue(“”)}
though it adds some numbers (e.g., .1
) at the end of some exported strings.
And here proposes a small script that does the job given the CLSID. Pseudocode:
[activator]::CreateInstance([type]::GetTypeFromCLSID($CLSID)) | Get-Member
One caveat, I don't know PowerShell and the above oneliner is most probably wrong.
I would appreciate it if you could help me know how I can get the list of methods and properties of a COM object knowing its ProgID (e.g., WScript.Shell
), using the above snippets or any other way.
P.S. It doesn't have to be necessarily a PowerShell solution. cmd/batch, JScript, and VBScript solutions are also appreciated.
Public methods and properties are exposed if you instanciate an object from the COM Object
will return
The @Simon Mourrier strategy will work fine too