PowerTip: Easily Find the PowerShell ApartmentState

Summary: Easily find the Windows PowerShell ApartmentState.

Hey, Scripting Guy! Question How can I easily find the Windows PowerShell ApartmentState?

Hey, Scripting Guy! Answer Use the $host automatic variable, and select the ApartmentState property from the RunSpace object, as shown here.

PS C:\> $Host.RunSpace.ApartmentState


Comments (2)

  1. This is a PowerTip that everyone who uses PowerShell needs to know. Cheers, Craig

  2. Ed Wilson says:

    @Craig Lussier thanks. I am glad you like the tip. I appreciate the feedback.

Skip to main content