You can read the local value here:
Key: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters"
Value: "srvcomment"
 Code:
$Key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters" 
$Value = "srvcomment"
$Desc = ReadValue($Key, $Value)
For AD query, you can use the ADSIObjectInfo() or fnLDAPQuery() functions. No special permissions are needed to READ an AD object.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D