Jump to content

Querying the Display Name without AD

Recommended Posts

I have a script that references the user's name. Currently, I'm doing that with a vbscript that queries AD. But I'm having a problem when a machine is on a different domain than the user. Thinking about it a little further, my script wouldn't work for anyone who's offline or otherwise cannot contact a DC.

Surely there's a way to find the current Display Name, since it shows up quite clearly right at the top of the Start Menu.

Any ideas?

Link to comment
Share on other sites

when you say "Display Name" and that it "shows up quite clearly right at the top of the Start Menu." you mean the currently logged in user?


“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”


Link to comment
Share on other sites

I'm sure it's sored somwhere in the cached credentials - loot in that direction.

Post what you find out because I'm sure this is interesting to sonme others as well. :)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

  • Moderators

I would think you could do a simple call to WMI? Something like:

$WMI = ObjGet("WinMgmts:root/cimv2")
$colQuery1 = $WMI.ExecQuery("Select UserName FROM Win32_ComputerSystem")

For $item In $colQuery1
    $ID = $item.UserName

$colQuery2 = $WMI.ExecQuery("Select * FROM Win32_NetworkLoginProfile")

For $object In $colQuery2
    If $object.Name = $ID Then
        MsgBox(0, "", $object.Fullname)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...