![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | Accessing remote COM Objects Can i access a remote COM object with powershell? New-Object doesn't provide a -computerName parameter like CreateObject has an optional ServerName property... -- Joris van Lier Please note that all scripts and opinions are supplied "as is" and with no warranty Blog: http://whizzrd.spaces.live.com |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Accessing remote COM Objects Joris van Lier wrote: > Can i access a remote COM object with powershell? > > New-Object doesn't provide a -computerName parameter like > CreateObject has an optional ServerName property... I know i can be thick sometimes, and i don't expect complete dissertations on the subject, i'm thinking about creating an "activator" object with two parameters: clsid and computername, that would allow me to PS> $remoteObject = new-Object -com My.ComActivator "Some.ComObject","thatserver" This might done without compilation using a WScript Component (this option wouldn't force an ordinairy admin into programming) , or with a real COM Object, but i'd prefer a pure .NET/Powershell solution. suggestions are welcome.... -- Joris van Lier Please note that all scripts and opinions are supplied "as is" and with no warranty Blog: http://whizzrd.spaces.live.com |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Accessing remote COM Objects > Can i access a remote COM object with powershell? Like you said, new-object doesn't provide a way to do this. An alternative that might work, though I haven't tried it, is using the VB library in the framework: PS C:\> [Reflection.Assembly]::LoadFrom("C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Microsoft.VisualBasic.dll") GAC Version Location --- ------- -------- True v2.0.50727 C:\Windows\assembly\GAC_MSIL\Microsoft.VisualBasic\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualB... PS C:\> [microsoft.visualbasic.interaction] | gm -stat CreateObject TypeName: Microsoft.VisualBasic.Interaction Name MemberType Definition ---- ---------- ---------- CreateObject Method static System.Object CreateObject(String ProgId, String ServerName) PS C:\> [microsoft.visualbasic.interaction]::CreateObject("Some.COMObject", "Computer") -- Marcel Ortiz [MSFT] Windows PowerShell Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. "Joris van Lier" <whizzrd@hotmail.com> wrote in message news:eHcCpbwlHHA.4188@TK2MSFTNGP02.phx.gbl... Joris van Lier wrote: > Can i access a remote COM object with powershell? > > New-Object doesn't provide a -computerName parameter like > CreateObject has an optional ServerName property... I know i can be thick sometimes, and i don't expect complete dissertations on the subject, i'm thinking about creating an "activator" object with two parameters: clsid and computername, that would allow me to PS> $remoteObject = new-Object -com My.ComActivator "Some.ComObject","thatserver" This might done without compilation using a WScript Component (this option wouldn't force an ordinairy admin into programming) , or with a real COM Object, but i'd prefer a pure .NET/Powershell solution. suggestions are welcome.... -- Joris van Lier Please note that all scripts and opinions are supplied "as is" and with no warranty Blog: http://whizzrd.spaces.live.com |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Accessing remote COM Objects Marcel J. Ortiz [MSFT] wrote: >> Can i access a remote COM object with powershell? > Like you said, new-object doesn't provide a way to do this. > > An alternative that might work, though I haven't tried it, is using > the VB library in the framework: > > PS C:\> > [Reflection.Assembly]::LoadFrom("C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Microsoft.VisualBasic.dll") > > GAC Version Location > --- ------- -------- > True v2.0.50727 > C:\Windows\assembly\GAC_MSIL\Microsoft.VisualBasic\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualB... > > PS C:\> [microsoft.visualbasic.interaction] | gm -stat CreateObject > > > TypeName: Microsoft.VisualBasic.Interaction > > Name MemberType Definition > ---- ---------- ---------- > CreateObject Method static System.Object CreateObject(String > ProgId, String ServerName) > > > PS C:\> > [microsoft.visualbasic.interaction]::CreateObject("Some.COMObject", > "Computer") Thanks for the tip Marcel, this is much better than my WScript Component method |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trouble Accessing messages from remote pc | carlie | Vista mail | 1 | 06-30-2008 01:24 PM |
| Remote Management Objects | Flowering Weeds | PowerShell | 3 | 10-09-2007 06:24 AM |
| Is there a way of accessing performance objects ? | Ian_m | PowerShell | 5 | 07-25-2007 06:14 AM |
| Accessing Remote Device Manager | adamruth@gmail.com | Vista networking & sharing | 0 | 01-25-2007 10:14 AM |
| Accessing code behind objects | Jan Kucera | Avalon | 0 | 11-15-2006 01:39 AM |