Check for Apartment state before loading modules
description
Hi, I suggest that you check the apartment state before loading any modules. WPK in particular is pretty big, so it's a waste of processing time to load it if the user has to restart PowerShell anyway.
Here is code that checks the state:
((get-host).RunSpace).ApartmentState