i am trying to get an custom object back from remote sesion to my local session and i want the methods to be entacted i.e. i want the de-serialised object to convert back to "live" object how can i do this. do i need to add any changes in the types.ps1 file of powershell
"Live" objects can not be transmitted directly over the Microsoft remoting protocol so they are first serialized as XML. The remote machine that contains the cmdlets typically have type formatting information but Microsoft only rehydrates certain types by default. In cases, where you are dealing with types other than those defaults it may be necessary to update the type formatters locally so the deserialization process correctly interprets that data.
I think these articles should he help explain what is going on in more detail:
How objects are sent to and from remote sessions
PowerShell 2.0 remoting guide: Part 11 – Interpreting, formatting and displaying remote output
Here is a link to the Remoting Protocol for all the gory details about the implementation:
PowerShell Remoting Protocol Specification
thanks for your reply.
i have gone through the documents and sites listed here and found out that the conversion of deseriliased.* to proper format is handled by the System.Management.Automation.PSTypeConverter can give me some details of working of this class so i can implement my own formatter .
It is a matter of protocol. With PS remoting, objects are transferred as "text", so they always disconnect from live objects, and there is hardly anything you can do about it.
If you used classic DCOM remoting, you get back live objects (for example, when you use Get-WMIObject with -ComputerName). This is handled by the DCOM mechanism.
Most problems with object methods can be solved by carefully designing your remoting code. Make sure all logic that requires live objects gets transferred to the remote machine. Remember: inside the remote session, your code has access to live objects. It is only when the data travels back to your client when objects turn into read-only objects.
is DCOM as preferable way of getting the live objects back while using the PSremoting and if yes can u provide some pointers for the DCOM implementation in power shell .also is there any way of exposing the PRIVATE data members of a .net type while using powershell remoting techniques .