Powershell STA watin

Wow, two posts on the same day.

I was working on a quick DLL project to do some web scripting using the awsome power of Watin.  In the past I use to create a vbscript as the test handler to call the DLL but lately I got a Powershell bug to call .NET DLLs.

When I tried to debug the Watin call I received:

The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.

I couldn't find a quick google answer to powershell apartmentstate .  Apparently you can set the powershell apartment state by the command line -STA. 

http://technet.microsoft.com/en-us/library/dd315276.aspx

I've found that the powershell documentation and examples is lacking compared to the Microsoft support I've come to expect.  Why is the Powershell v2.0 in C:\WINDOWS\SYSTEM32\windowspowershell\v1.0 ?

Print | posted on Thursday, June 10, 2010 11:53 AM