There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Check for Apartment state before loading modules
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: