ID: 19192 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Feedback +Status: Closed Bug Type: COM related Operating System: NT, 2000, XP PHP Version: 4.2.2 New Comment:
foreach only works with arrays, try while ($group = $objComputer->Next()) { ... } Previous Comments: ------------------------------------------------------------------------ [2002-10-04 02:53:20] [EMAIL PROTECTED] foreach only works with arrays, try while ($group = $objComputer->Next()) { ... } ------------------------------------------------------------------------ [2002-09-26 19:52:52] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip ------------------------------------------------------------------------ [2002-09-05 15:46:27] [EMAIL PROTECTED] I don't remember if anything has been backported to it or not, but any chance you can test against the 4.2.3RC's and see if this still continues. ------------------------------------------------------------------------ [2002-08-30 04:09:59] [EMAIL PROTECTED] Following code "should" list all NT-Usergroups of the given machinename or nt-domain. This works with ASP but not PHP :(... Array $objComputer is created but it only consists of one recordset (the first one, the machine itself). But there should be more in it! (Groups, Users, Services) <?php $objComputer = new COM("WinNT://machinename"); echo $objComputer->Name." is a ".$objComputer->Class." and has following NT-Groups:<p>"; $objComputer->filter = array("Group"); foreach($objComputer as $group) { print $group->name."<br>\n"; } echo "Group listing complete."; ?> And here the WORKING Code using ASP: <% Set GroupObj = GetObject("WinNT://machinename") strFilter = Array("Group") BaseObj.Filter= strFilter Response.write "---- Select a Group ----<p>" For Each Member in BaseObj Response.write Member.Name & "<br>" Next %> BTW: "WinNT://" is a VALID COM-Data Provider!!! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19192&edit=1