1

Like the title says, how can I remove GAC assembly file using vbscript?

Mike G
  • 4,232
  • 9
  • 40
  • 66

4 Answers4

1

You can run this to uninstall it from GAC:

gacutil /u YourAssembly
Mikael Söderström
  • 1,008
  • 8
  • 15
0

Here's how you can call the gacutil tool from VBScript:

Const GACUTILPATH = "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe"
strAssembly = "MyAssembly"  '' or "MyAssembly,Version=1.1.0.0,Culture=en,PublicKeyToken=874e23ab874e23ab"

Set oShell  = CreateObject("WScript.Shell")
oShell.Run """" & GACUTILPATH & """ /nologo /u " & strAssembly
Helen
  • 87,344
  • 17
  • 243
  • 314
0

As I remember gacutil in a .NET enabled shell.

C:\>gacutil
Microsoft (R) .NET Global Assembly Cache Utility.  Version 3.5.21022.8
Copyright (c) Microsoft Corporation.  All rights reserved.

Usage: Gacutil <command> [ <options> ]
Commands:
  /i <assembly_path> [ /r <...> ] [ /f ]
    Installs an assembly to the global assembly cache.

  /il <assembly_path_list_file> [ /r <...> ] [ /f ]
    Installs one or more assemblies to the global assembly cache.

  /u <assembly_display_name> [ /r <...> ]
    Uninstalls an assembly from the global assembly cache.

  /ul <assembly_display_name_list_file> [ /r <...> ]
    Uninstalls one or more assemblies from the global assembly cache.

  /l [ <assembly_name> ]
    List the global assembly cache filtered by <assembly_name>

  /lr [ <assembly_name> ]
    List the global assembly cache with all traced references.

  /cdl
    Deletes the contents of the download cache

  /ldl
    Lists the contents of the download cache

  /?
    Displays a detailed help screen

 Options:
  /r <reference_scheme> <reference_id> <description>
    Specifies a traced reference to install (/i, /il) or uninstall (/u, /ul).

  /f
    Forces reinstall of an assembly.

  /nologo
    Suppresses display of the logo banner

  /silent
    Suppresses display of all output
kenny
  • 21,522
  • 8
  • 49
  • 87
0

You can use WSH with VBScript, and open the file using WSH.

http://www.mhuffman.com/notes/language/vbs_intro.htm

Mikael Söderström
  • 1,008
  • 8
  • 15