powershell-sdk

Custom PowerShell Host and Converting PSObject back to base type

When hosting the PowerShell runtime is it possible to convert a PSObject back into its original type some how? For example: I have a cmdlet that calls WriteObject and pushes a collection of ClassXzy in the pipeline. When I call PowerShell.Invoke from the host end of things I retrieve a collection of PSObjects with a BaseObject propert...

How can I run initialization code each time my snap-in is loaded?

I have a PowerShell snapin, and I would like to run a bit of initialization code (hooking some AppDomain events) each time my snapin is loaded (i.e. once for each powershell.exe process that is started). How can this be accomplished? ...