Getting user details from Network ID in active directory using Php?

Every organization assigns a ID called “Network ID” for the user to login into their internal network and this internal network is called as “Active Directory”

Though there is no command to get the user details directly from the network ID in php, there is a workaround way which involves executing a shell command and getting the output of those details to parse the user details

Step 1: Add the below code to your php script

$UserID="123456";
exec("NET USER /DOMAIN ".$UserID." 2>1",$output);
print_r($output);

This will output the UserDetails as shown from which we can get the details of this array like UserName and FullName



Scroll to Top