Friday, April 20, 2012

Use Powershell to put your assemblies in the GAC

To use your own custom build workflows for FIM 2010, you need to put the hosting assemblies in the Global Assembly Cache (GAC) in the server hosting the FIM Service.

Normally, you'd want to download the .NET Framework SDK and get a hold of the Global Assembly Cache Tool (Gacutil.exe) which you certainly can use for the job of putting a DLL in the GAC. However, often times the SDK is not installed on the FIM Server and you may not even want to install this on your FIM Server.

PowerShell to the rescue. Since Gacutil.exe probably use .NET functions to get the job done, why not use the same functions from PowerShell and save the huge download and install?

Just get this short script which you can use instead of Gacutil.exe to put one or more assemblies in the cache without needing the .NET Framework SDK.

To learn how to use the script, just read the embedded help which also contains examples. Type this command in a PowerShell prompt -

Get-Help .\Add-AssemblyToGlobalAssemblyCache.ps1 -Detailed

Happy scripting...

2 comments: