PowerShell to install uninstall dll from GAC

Most of the we need to install and uninstall dll from GAC,so here is the simple set of script to simplify this task.

#replace it with your dll path 
$dllPath ="C:\temp\FileName.dll" 
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish      

#to unistall dll from GAC
$publish.GacRemove($dllPath)
iisreset

#to install dll from GAC
$publish.GacInstall($dllPath)
iisreset

Download Source code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s