Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Getting Interface ID back from a COM object?

Reply
 
Old 08-15-2006   #1 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Getting Interface ID back from a COM object?

Is there a simple way to get the interface ID back from a COM object? It
doesn't appear to be a distinct entity, but the GUID appended to the
System.__ComObject type in object names appears to be an interface ID. The
only way I can get it right now is to use the following fairly ugly
string-hacking technique:

$xh = New-Object -ComObject Microsoft.XmlHttp
$typenames = $xh.PSObject.Typenames;
for($i = 0; $i -lt $typenames.Count)
{
if($typenames[$i].Contains("#"))
{
$start = $typenames[$i].IndexOf("#") + 1;
$typenames[$i].Substring($start);
}
}


Obviously, this is less than desirable, since I'm doing work to separate an
item that is apparently available as a distinct string already.



My System SpecsSystem Spec
Old 08-15-2006   #2 (permalink)
Abhishek Agrawal [MSFT]


 
 

Re: Getting Interface ID back from a COM object?

What you are doing it the only way as far as I recall. We do not expose it
as an separate property; only as part of the typename

--
Abhishek Agrawal [MSFT]
http://abhishek225.spaces.live.com
Windows PowerShell Team
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.


"Alex K. Angelopoulos [MVP]" <aka@online.mvps.org> wrote in message
news:e6DvfiIwGHA.4216@TK2MSFTNGP06.phx.gbl...
> Is there a simple way to get the interface ID back from a COM object? It
> doesn't appear to be a distinct entity, but the GUID appended to the
> System.__ComObject type in object names appears to be an interface ID. The
> only way I can get it right now is to use the following fairly ugly
> string-hacking technique:
>
> $xh = New-Object -ComObject Microsoft.XmlHttp
> $typenames = $xh.PSObject.Typenames;
> for($i = 0; $i -lt $typenames.Count)
> {
> if($typenames[$i].Contains("#"))
> {
> $start = $typenames[$i].IndexOf("#") + 1;
> $typenames[$i].Substring($start);
> }
> }
>
>
> Obviously, this is less than desirable, since I'm doing work to separate
> an item that is apparently available as a distinct string already.
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Problem calling interface of .NET Remoted object via Powershell PowerShell
Writing an array back in to an AD Object PowerShell
Change from Chinese windows back to English interface. Vista General
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46