Il seguente script, se eseguito con elevati privilegi, permette di aggiungere un assembly alla GAC tramite PowerShell:

PowerShell

$assembly="c:\percorso\itextsharp.dll" 
# in alternativa per usare il percorso corrente: $assembly="$pwd\itextsharp.dll"

[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish

$publish.GacInstall($assembly)

per rimuoverlo sostituire GacInstall con GacRemove

PowerShell

$publish.GacRemove($assembly)

Vedi originale in inglese Add and Remove an Assembly from the GAC using PowerShell
Tags:
C#235 .NET66 PowerShell199
Potrebbe interessarti anche: