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

  1. ' Filename: InstPak.vbs
  2. '
  3. ' Description: Sample VB Script that installs the Sample Bank package from a .pak file
  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 path
  17. Dim pakPath
  18.  
  19. path = "C:\Program Files\Samples\Packages\"
  20. pakPath = path & "Sample Bank.pak"
  21. packageName = "Sample Bank"
  22.  
  23. ' First, we create the catalog object
  24. Dim catalog
  25. Set catalog = CreateObject("MTSAdmin.Catalog.1")
  26.  
  27. ' Then we get the packages collection
  28. Dim packages
  29. Set packages = catalog.GetCollection("Packages")
  30. packages.populate
  31.  
  32. ' Remove all packages that go by the same name as the package we wish to install
  33. numPackages = packages.Count
  34. For i = numPackages - 1 To 0 Step -1
  35.     If packages.Item(i).Value("Name") = packageName Then
  36.         packages.Remove (i)
  37.     End If
  38. Next
  39.  
  40. ' Commit our deletions
  41. packages.SaveChanges
  42.  
  43. ' Add the new package from a .pak file
  44. Dim util
  45. Set util = packages.getUtilInterface
  46. util.InstallPackage pakPath, "", mtsInstallUsers