Saturday, July 2, 2016

Uninstall DLL from Gac using Powershell

In some cases we might face issue while deleting the dll from GAC( usually it will say its in use by some process) and it will always annoying, to over come this here is small powershell script which will be handy.

Set-location "Folder path of the DLL"          
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")          
$publish = New-Object System.EnterpriseServices.Internal.Publish          
$publish.GacRemove("FolderPath\DLL.dll")          
iisreset