Import-Module from GAC for PowerShell Usage

Try the Add-Type cmdlet:

Add-Type -Assembly My.PowerShell.DocumentConversion

If it's not working try the LoadWithPartialName method:

[System.Reflection.Assembly]::LoadWithPartialName('My.PowerShell.DocumentConversion')

Or using the full path:

[System.Reflection.Assembly]::LoadFile(...)

As long as the assembly is in the GAC, just use the strong name to reference the assembly. To get the path to the GAC be aware it has changed in .Net 4.0 http://en.wikipedia.org/wiki/Global_Assembly_Cache

$assemblyPath = 'path to the assembly file in the gac'
$fullName = [System.Reflection.AssemblyName]::GetAssemblyName($assemblyPath).FullName
[System.Reflection.Assembly]::Load($fullName)

Tags:

Powershell

Gac