Author Posts

March 9, 2015 at 12:21 am

Hi all,

This is my first post !
In the line [System.Windows.Forms.MessageBox]::Show("Hello World!") what does the :: mean/do ?
Also, why is there the need to use "System.Windows.Forms.MessageBox" and not a verb-noun syntax ? What is the difference ?

Many thanks all !

March 9, 2015 at 12:45 am

Hi Graham,

You are referring to a .NET class, which will often require you to specify it's entire name space as well. The '::' tells PowerShell that what follows is one of the attributes of the class, which typically can consists of one or more constructors, enumerations, methods, or properties.

Take a look at to get an idea what I'm referring to.

This is also the reason why there is no Verb-Noun format. You're not referring to a PowerShell cmdlet, but directly to a .NET class.

If you want to get a list of currently registered cmdlets, you can use the [b]Get-Command[/b] Cmdlet.

There's some pretty good articles available about using .NET with PowerShell. Take a look at Scripting Guy who has written a few.

Hope this helps.