19 April 2012

Export DHCP scope rezervation settings

Lunch command prompt window with "Run As Administrator" option (or the command will not work):


netsh dhcp server file://server_name/ scope 192.168.1.0 dump > rezervations.txt




To find a rezervation for speciefic MAC address:

netsh dhcp server \\server_nema scope 192.168.1.0 show reservedip | find "MAC-ADDRESS"

("MAC-ADDRESS" must include dashes)

Retrieve active directory user OU.

User's organizational unit information can be easily extracted from user's DistinguishedName ldap attribute:

$user = Get-ADUser marius.dumitru
$ou = $user.DistinguishedName.Substring($user.DistinguishedName.IndexOf("OU="))

result:

OU=Some users,DC=domain,DC=intra