1
Vote

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

comments

dfinke wrote Aug 10, 2010 at 2:09 AM

fixed Change Set 58820



** Closed by dfinke 8/9/2010 6:09 PM

dfinke wrote Aug 10, 2010 at 2:09 AM

fixed Change Set 58820