Quantcast
Viewing all articles
Browse latest Browse all 34890

PowerTip: Easily Find the PowerShell ApartmentState

Summary: Easily find the Windows PowerShell ApartmentState.

Image may be NSFW.
Clik here to view.
Hey, Scripting Guy! Question
 How can I easily find the Windows PowerShell ApartmentState?

Image may be NSFW.
Clik here to view.
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

STA

Image may be NSFW.
Clik here to view.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 34890

Trending Articles