Add-Type

noun

say it: “AD TYPE” /ˈæd ˈtaɪp/

A PowerShell command that loads an extra part of .NET so a script can use the types inside it.

What does Add-Type do?

Add-Type loads an extra part of .NET into your PowerShell session, so you can use the types inside it. Some parts, such as Windows Forms, aren't loaded until you ask.

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Button]::new().GetType().Name   # Button

In a sentence

  • “Sam's window script starts with Add-Type -AssemblyName System.Windows.Forms.”
  • “Without Add-Type, PowerShell didn't know the Form type.”

Level: Freelancer · More PowerShell terms at this level

Updated