Home

Saturday, August 18, 2012

Retrieve windows username in php

<?php
              $nw = new COM("WScript.Network");
              print "username: " . $nw->username . "<br><br>";

              $computername = $nw->computername;
              print "computername: $computername<br><br>";

              $owmi = new COM("winmgmts:\\\\$computername\\root\\cimv2");
              $comp = $owmi->get("win32_computersystem.name='$computername'" );

                print "username: " . $comp->username;
?>

No comments:

Post a Comment

rathoddhirendra.blogspot.com-Google pagerank and Worth