![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||