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!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.