home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / mts4.cab / WSH_Uninst.vbs < prev    next >
Text File  |  1997-11-14  |  1KB  |  37 lines

  1. ' Filename: Uninst.vbs
  2. '
  3. ' Description: Sample VB Script that uninstalls the Sample Bank package
  4. '
  5. ' This file is provided as part of the Microsoft Transaction Server Samples
  6. ' See the MTS Software Development Kit for more information on Scriptable Administration Objects
  7. '
  8. ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT 
  9. ' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 
  10. ' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
  11. ' OF MERCHANTABILITY AND/OR FITNESS FOR A  PARTICULAR 
  12. ' PURPOSE.
  13. '
  14. ' Copyright (C) 1997 Microsoft Corporation, All rights reserved
  15.  
  16. Dim packageName
  17. packageName = "Sample Bank"
  18.  
  19. ' First, we create the catalog object
  20. Dim catalog
  21. Set catalog = CreateObject("MTSAdmin.Catalog.1")
  22.  
  23. ' Then we get the packages collection
  24. Dim packages
  25. Set packages = catalog.GetCollection("Packages")
  26. packages.populate
  27.  
  28. ' Remove all packages that go by the same name as the package we wish to uninstall
  29. numPackages = packages.Count
  30. For i = numPackages - 1 To 0 Step -1
  31.     If packages.Item(i).Value("Name") = packageName Then
  32.         packages.Remove (i)
  33.     End If
  34. Next
  35.  
  36. ' Commit our deletions
  37. packages.savechanges