home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
mts4.cab
/
WSH_InstPakCLI.vbs
< prev
next >
Wrap
Text File
|
1997-11-14
|
2KB
|
54 lines
' Filename: InstPakCLI.vbs
'
' Description: Sample VB Script that installs the Sample Bank package from a .pak file
'
' This file is provided as part of the Microsoft Transaction Server Samples
' See the MTS Software Development Kit for more information on Scriptable Administration Objects
'
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT
' WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
' INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
' OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
' PURPOSE.
'
' Copyright (C) 1997 Microsoft Corporation, All rights reserved
'
' Use: InstPakCLI.vbs "pak path"
' Ex: InstPakCLI.vbs "C:\Program Files\MTX\Samples\Packages\"
' Get arguments
Dim objArgs
Set objArgs = WScript.Arguments
' Set up path names
Dim path
Dim pakPath
path = objArgs(0)
pakPath = path & "Sample Bank.pak"
packageName = "Sample Bank"
' First, we create the catalog object
Dim catalog
Set catalog = CreateObject("MTSAdmin.Catalog.1")
' Then we get the packages collection
Dim packages
Set packages = catalog.GetCollection("Packages")
packages.populate
' Remove all packages that go by the same name as the package we wish to install
numPackages = packages.Count
For i = numPackages - 1 To 0 Step -1
If packages.Item(i).Value("Name") = packageName Then
packages.Remove (i)
End If
Next
' Commit our deletions
packages.SaveChanges
' Add the new package from a .pak file
Dim util
Set util = packages.getUtilInterface
util.InstallPackage pakPath, "", 0