Add a .NET Framework type to a PowerShell session. If a .NET Framework class is added to your PowerShell session with Add-Type, those objects may then be instantiated (with New-Object ), just like any .NET Framework object.

      Add-Type -AssemblyName string[]
         [-IgnoreWarnings] [-PassThru] [CommonParameters]
      Add-Type [-Name] string [-MemberDefinition] string[]
         [-CodeDomProvider CodeDomProvider] [-CompilerParameters CompilerParameters]
            [-Language {CSharp | CSharpVersion3 | VisualBasic | JScript}]
               [-Namespace string] [-OutputAssembly string]
                  [-OutputType OutputAssemblyType] [-ReferencedAssemblies string[]]
                     [-UsingNamespace string[]] [-IgnoreWarnings] [-PassThru] [CommonParameters]
      Add-Type [-Path] string[] [-CompilerParameters CompilerParameters]
        [-OutputAssembly string]
           [-OutputType OutputAssemblyType] [-ReferencedAssemblies string[]]
              [-IgnoreWarnings] [-PassThru] [CommonParameters]
      Add-Type [-TypeDefinition] string [-CodeDomProvider CodeDomProvider]
         [-CompilerParameters CompilerParameters]
            [-Language {CSharp | CSharpVersion3 | VisualBasic | JScript}]
               [-OutputAssembly string] [-OutputType OutputAssemblyType]
                  [-ReferencedAssemblies string[]] [-IgnoreWarnings] 
                     [-PassThru] [CommonParameters]

      The name of an assembly that includes the types. Wildcard characters are permitted
      This parameter does not accept a path or file name. To enter the path to the assembly DLL, use -Path.

A code generator or compiler. The default is the CSharp compiler. -CompilerParameters
The options for the source code compiler. These options are sent to the compiler without revision.

Ignores compiler warnings. Dont handle compiler warnings as errors. -Language
Specifies the language used in the source code.
Valid values are "CSharp", "CSharpVersion3", "VisualBasic", and "JScript". "CSharp" is the default. -MemberDefinition
Specify new properties or methods for the class. -Name
The name of the class to create. Required when generating a type from a member definition. -Namespace
A namespace for the type. -OutputAssembly
Generate a DLL file for the assembly with the specified name in the location. By default, Add-Type generates the assembly only in memory. -OutputType
The output type of the output assembly. Valid values are Library, ConsoleApplication, and WindowsApplication.
By default, no output type is specified. -PassThru
Return a System.Runtime object that represents the types that were added. -Path
The path to source code files or assembly DLL files that contain the types. -ReferencedAssemblies
The assemblies upon which the type depends in addition to the default references, System.dll and System.Management.Automation.dll -TypeDefinition
The source code that contains the type definitions. Enter the source code in a string or here-string, or enter a variable that contains the source code. -UsingNamespace
Other namespaces that are required for the class. This is much like the Using keyword in C#. CommonParameters -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer and -OutVariable


"get-help Add-Type -examples"

“If you don't have time to do it right, when will you have time to do it over?” ~ John Wooden

© Copyright 1999-2014
Some rights reserved