![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | COM IDispatch and Powershell invocation Can Powershell handle COM invocation with Object implementing Idispatch interfaces. I would think so, however why can I run a piece of script via the VBS engine while Powershell failes. Please help! *********Powershell********* $b = New-Object -ComObject Station.Application $b | gm $b.connect("") TypeName: System.__ComObject Name MemberType Definition ---- ---------- ---------- CreateObjRef Method System.Runtime.Remoting.ObjRef CreateOb... Equals Method System.Boolean Equals(Object obj) GetHashCode Method System.Int32 GetHashCode() GetLifetimeService Method System.Object GetLifetimeService() GetType Method System.Type GetType() InitializeLifetimeService Method System.Object InitializeLifetimeService() ToString Method System.String ToString() Method invocation failed because [System.__ComObject] doesn't contain a method named 'connect'. At line:1 char:11 + $b.connect( <<<< "") *********VBS********* However, this seems to work. dim myStation set myStation = createobject("Station.Application") myStation.connect("") Any idea's about the difference? It's my understanding the PowerShell can handle Idispatch interface for late-bind of COM object. So why doesn't this work? |
| | #2 (permalink) |
| Guest | Re: COM IDispatch and Powershell invocation Does late-binding works? [system.__comobject]::invokemember("connect","[system.reflection.bindingflags]::invokemethod,$null,$b,$null) -- Yuksel Akinci [MSFT] Windows PowerShell Team Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scr.../hubs/msh.mspx "Kbgo" <Kbgo@discussions.microsoft.com> wrote in message news:879D3FA3-30BE-4330-B814-B70F84E02DE2@microsoft.com... > Can Powershell handle COM invocation with Object implementing Idispatch > interfaces. I would think so, however why can I run a piece of script via > the > VBS engine while Powershell failes. Please help! > > *********Powershell********* > > $b = New-Object -ComObject Station.Application > $b | gm > $b.connect("") > > > > TypeName: System.__ComObject > > Name MemberType Definition > ---- ---------- ---------- > CreateObjRef Method System.Runtime.Remoting.ObjRef > CreateOb... > Equals Method System.Boolean Equals(Object obj) > GetHashCode Method System.Int32 GetHashCode() > GetLifetimeService Method System.Object GetLifetimeService() > GetType Method System.Type GetType() > InitializeLifetimeService Method System.Object > InitializeLifetimeService() > ToString Method System.String ToString() > > Method invocation failed because [System.__ComObject] doesn't contain a > method > named 'connect'. > At line:1 char:11 > + $b.connect( <<<< "") > > > *********VBS********* > > However, this seems to work. > > dim myStation > set myStation = createobject("Station.Application") > myStation.connect("") > > > Any idea's about the difference? It's my understanding the PowerShell can > handle Idispatch interface for late-bind of COM object. So why doesn't > this > work? |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Method invocation failed | B Williams | PowerShell | 0 | 03-31-2008 05:46 PM |
| Remote invocation of ps commands? | Duncan Smith | PowerShell | 5 | 10-05-2007 12:12 PM |
| Function names and invocation | Hans Dingemans | PowerShell | 3 | 09-26-2007 01:12 AM |
| Late Binding with IDispatch based com objects | Vincent.Parrett@gmail.com | PowerShell | 1 | 05-09-2007 08:54 AM |