Check for Apartment state before loading modules

Aug 9, 2010 at 2:53 PM
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
Aug 10, 2010 at 1:23 AM

You are correct. I will add.



Aug 10, 2010 at 1:59 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Aug 10, 2010 at 2:13 AM