This is a general question:
I have a 2 powershell scripts (PS1 and PS2) in which one calls the other.
On execution from the command-line, at some point in PS1, PS2 is executed (at the moment this is done by a simple powershell -file PS2 + args)
At the end of PS2 execution, I'd like to build up an object of information (i intend to use a simple hashtable) which can be picked up by PS1.
I can pick up a $LASTEXITCODE if I use 'exit' in PS2, but I'm having trouble picking up anything more complex than an integer.
Instinctively, I feel that you must be able to do this - I have seen C# examples.
Is there a pattern I can follow that allows me to do this? (I don't want to pipe information out to temporary files if I can avoid it)