when i was adding things to iis4's transaction server, i used its com object
i dont know if it has changed with w2k

browsing through ole view, it looks like there is a com+ 1.0 admin type library that 
is somewhat similar

if i remember right (looking at the code..this was over a year ago, and my first 
perl->com attempt)

it looks like i had to shut down the package, then uninstall it before i tried to 
install it (or reinstall it)
keep in mind this is for iis4, when they called com+ "microsoft transaction server"

$oCatalog = Win32::OLE -> new('MTSAdmin.Catalog.1');
my $oPackages = $oCatalog -> GetCollection('Packages');
$oPackages -> Populate;
my @aryPackages = Win32::OLE::Enum -> All($oPackages);
my $numPackages = scalar(@aryPackages);

print printme("Searching for package [$strPackageName]");

my $packageMatch = 0;

my @matched_packages;
for (my $i = 0; $i < ($numPackages - 1); $i++)  {
        my $oPack = $oPackages -> Item($i);
        if ($oPack -> Value('Name') =~ /$strPackageName/i)      {
                $packageMatch++;
                push @matched_packages, $oPack -> Value('Name');
                my $oPackageUtil = $oPackages -> GetUtilInterface;
                if ($oPackageUtil)      {
                        $oPackageUtil -> ShutdownPackage($oPack -> Key);
                        $oPackages -> Remove($i);
                }
                else    {
                        $intWarn++;
                        print "\nWARNING:\n";
                        print "\tCannot GetUtilInterface for package [" . $oPack -> 
Value('Name') . "]\n";
                        print "\tI dont know how to troubleshoot this.\n";
                }
        }
}
my $oNewPackage = $oPackages -> Add;
$oNewPackage -> SetProperty('Value','Name',$strPackageName);
$oNewPackage -> SetProperty('Value','SecurityEnabled',"N");
$oNewPackage -> SetProperty('Value','Identity',$str_user);
$oNewPackage -> SetProperty('Value','Password', $str_password);
$oPackages -> SaveChanges;

# repopulate now that we have added the package back in
$oPackages -> Populate;
my $oComponents = $oPackages -> GetCollection('ComponentsInPackage', $oNewPackage -> 
Value('ID'));
my $oUtil = $oComponents -> GetUtilInterface;
$oUtil -> InstallComponent ("full path to dll", "", "");
$oComponents -> Populate;



please keep in mind that the above code was pulled from a larger working (mostly) 
script, and that you will probably need to modify it a lot

---tom


*********** REPLY SEPARATOR  ***********

On 6/22/2001 at 12:57 PM Jenda Krynicky wrote:

>Does anyone know how to register/unregister COM objects to/from
>Component Services?
>
>I need to be able to create a new COM+ Application if it's not there
>already and add/remove components to/from it.
>
>Just the name of an OLE object for this would be sufficient !
>
>Thanks, Jenda
>
>== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
>: What do people think?
>What, do people think?  :-)
>             -- Larry Wall in <[EMAIL PROTECTED]>
>_______________________________________________
>Perl-Win32-Admin mailing list
>[EMAIL PROTECTED]
>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to