I'm looking for a way to control the scope of assemblies loaded into a #powershell
session -- something along the lines of firing up a new AppDomain that would inherit everything from its parent, but everything I load there would be discarded when I close it.
I thought runspaces might be the thing, but based on initial experimentation, I can open up a new runspace from a console session and have it load assemblies for me. What it doesn't do, however, is get rid of the assemblies when I close it, so I guess it's not in a separate AppDomain after all.
The reason I'm doing this is that I'm working on a module that downloads .NET libraries using NuGet and then imports them to the current session -- the idea being that sometimes it would be nice to try out the features of some library or another, but downloading and importing it to the session are somewhat tedious. Pointers would be most welcome.