If you are managing Sharepoint or Active Directory Federation Services, you sometimes have to register DLLs in the GAC without your supplier providing you a nice MSI installer to do so.
Once solution would be use gacutil but it is now a .Net Framework Utility, and you may not want to copy it on your servers. To accomplish the same thing using Powershell solely, you may run these lines:
1 2 3 |
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") $publisher = New-Object System.EnterpriseServices.Internal.Publish $publisher.GacInstall("C:\path\MydllToRegister.dll") |
Don not forget that you can retrieve many properties of the assembly, such as the public token, just by loading it:
1 |
([system.reflection.assembly]::loadfile("C:\path\MydllToRegister.dll")).FullName |