O'Reilly logo

Mastering PowerCLI by Sajal Debnath

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a GUI using Windows Forms

The first option that we will discuss is Windows Forms. To utilize Windows Forms, we first need to load the respective assemblies. We can load the assemblies by using the following techniques:

[void][System.Reflection.Assembly]::LoadWithPartialName
("System.Drawing")
[void][System.Reflection.Assembly]::LoadWithPartialName
("System.Windows.Forms")

Alternatively, we can use the following technique:

Add-Type -AssemblyNameSystem.Windows.Forms
Add-Type -AssemblyNameSystem.Drawing

Once the assemblies are loaded, we need to load the visual styles method as well. We can load the module by using the following method:

[void] [System.Windows.Forms.Application]::EnableVisualStyles()

I prefer using [void] to add the assemblies ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required