PowerShell for Windows Admins

May 2 2016   7:45AM GMT

Loading assemblies

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Powershell

PowerShell is .NET based but doesn’t load all available .NET assemblies when it starts.

Many people still use something  like

[System.Reflection.Assembly]::LoadWithPartialName(‘System.Windows.Forms’)

to load additional assemblies.  This is a hang over from PowerShell v1 when there wasn’t another way to perform the load.

The LoadWithPartialName method has been deprecated – https://msdn.microsoft.com/en-us/library/12xc5368(v=vs.110).aspx – and shouldn’t be used.

Your alternatives are:

Add-Type -AssemblyName System.Windows.Forms

or in PowerShell v5

using assembly System.Windows.Forms

using namespace System.Windows.Forms

can be used

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: