COM/DCOM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

 

I'm trying to write a few scripts to help automate some Windows
administration tasks. One of these is to add people to groups on
different networked machines.

 

I've written something like the following:

 

<?php

$computer = "TestComputer";

$groupName = "TestGroup";

$server_config = array('Server' => TestComputer' , 'Username' =>
'TestUser' , 'Password' => 'TestPass');

// list all current group members

$domainObject = new
COM("WinNT://".$computer."/".$groupName.",group",$server_config) or
die("Cannot create COM object");

foreach ($domainObject->Members as $var)

{

          echo $var->Name."<br>";

}

// add person to group

$usertoadd = "APerson";

$domainUser = new
COM("WinNT://DOMAIN/".$usertoadd.",user",$server_config) or die("Cannot
create COM object ");

$domainObject->Add($domainUser->ADsPath);

 

?>

 

TestUser is a local administrative account on TestComputer.

 

If I run apache using the standard local system account, the code lists
the members of the group but refuses to add APerson. If I run apache
with a domain administrator account it works fine, but I don't want to
do this - I want to be able to pass the username and password of an
account on the target machine that has permissions set up for this
purpose.

 

I've tried making changes using dcomcnfg on the target machine, but no
luck so far. 

 

Does anyone have any experience in using COM functions and can spot
anything I'm doing wrong or a misunderstanding in how it works?

 

Thanks,

Jon

 

---------

This e-mail does not reflect the views or opinions of Travellers Tales
(UK) Ltd or any other related TT Games group company.

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux