Get Username

One of the things we find handy is the ability to know who is logged on to a given computer at any one time. The main reason is that our users rarely tell us which computer they are on when they submit a help-request, so if we have someplace to look that makes our jobs that much easier.

The Getuser function returns the name of the currently logged on user, or the word “FREE” if nobody is logged on. I use this in conjunction with another function that updates the Active Directory description property of the computer object.

This function accepts one parameter:

  • strComputer


This string variable is usually passed from a calling routine. That routine may be working through a .csv file or it may be pulling this data direct from Active Directory.

Get Prop

GetProp is a generic function that is used to return single-valued properties from objects in the Active Directory. If the property is empty it writes an entry to the application log via the LogData routine.

This function accepts two parameters:

  • strADSPath
  • strProperty


This is the DistinguishedName property of the object that we are working on. It is generated somewhere outside of this routine.


This is just whatever single-valued property that we are looking for. A listing of all properties for Active Directory Objects can be found on the main page of this site.