Add-GacAssembly.ps1
Script
Name | Description | Last Modified Date | Download |
---|---|---|---|
Add-GacAssembly.ps1 | Adds a folder's items to the GAC. |
| None |
#Thanks to: https://www.andrewcbancroft.com/2015/12/16/using-powershell-to-install-a-dll-into-the-gac/ #Summary: Adds the contents of a folder to the GAC. Only gets .dll files. #Example: .\Add-GacAssembly.ps1 .\MySubFolder param ( $location = $(throw '- location required') ) #Run PowerShell as an Administrator [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publish = New-Object System.EnterpriseServices.Internal.Publish $inputFiles = Get-ChildItem "$location\*.dll" foreach ($file in $inputFiles) { write-host "File $file" -NoNewLine $publish.GacInstall($file.FullName) write-host " has been added to the GAC" }
CodeMonkey Software is a division of JCHMedia www.jchmedia.com