Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MTS Pacakge Creation

Status
Not open for further replies.

nomi2000

ISP
Feb 15, 2001
676
CA
Dears
I want is there any way i can automate the process of
MTS Package Creation plus .dlls install in that Package
i want it very urgent
Pleas Help me
Nouman
 
Of course you can do it using MTSAdmin API.Here is some code snippet (delphi):
....
TDLLInfo = record
PkgName : string;
DLLFile : string; //The DLL file
SecurityEnabled : Char; //Enable security ('N'/'Y')
end;
....
{Function : Install some package from *.dll files
In : SrvrName - Server to which the given DLLs will be installed
ADLLInfo- an array of package info.
Out : N/A
Authors : allen
Last Updated : 1999-07-28
}
procedure InstDLLFile(const SrvrName:string; const ADLLInfo:array of TDLLInfo);
var i,j : Integer;
ACatalog : ICatalog;
ARoot,APkgs,AComps : ICatalogCollection;
ANewPkg : ICatalogObject;
ACompUtil : IComponentUtil;
begin
ACatalog := CoCatalog.Create; //First, we create the catalog object
//Then we get the packages collection
ARoot := ACatalog.Connect(SrvrName) as ICatalogCollection;
APkgs := ARoot.GetCollection('Packages','') as ICatalogCollection;
APkgs.Populate;
//Remove all packages that go by the same name as the package we wish to install
for i:=0 to SizeOf(ADLLInfo) div SizeOf(ADLLInfo[0]) - 1 do
for j:=APkgs.Count-1 downto 0 do
if ICatalogObject(APkgs.Item[j]).Value['Name'] = ADLLInfo.PkgName then
APkgs.Remove(j);
APkgs.SaveChanges;
//Install
for i:=0 to SizeOf(ADLLInfo) div SizeOf(ADLLInfo[0]) - 1 do begin
ANewPkg := APkgs.Add as ICatalogObject;
ANewPkg.Value['Name'] := ADLLInfo.PkgName;
ANewPkg.Value['SecurityEnabled'] := ADLLInfo.SecurityEnabled;
APkgs.SaveChanges; //Commit it
APkgs.Populate; //Refresh it
//Get components collection for new package
AComps := APkgs.GetCollection('ComponentsInPackage',ANewPkg.Value['ID']) as ICatalogCollection;
//Install components
ACompUtil := AComps.GetUtilInterface as IComponentUtil;
ACompUtil.InstallComponent(ADLLInfo.DLLFile,'','');
end; //for i
end;
......
Hope this can help you! zallen@cmmail.com
Long live of freedom!
 
Dears
Thanx for you help.i really appreciate it
all of you who help me..
THanx again
Nouman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top