Jump to content

Recommended Posts

Posted

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?

Posted

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?

msgbox(0,"",@UserName)
  Reveal hidden contents

 

Posted

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]
Posted

  On 8/14/2012 at 5:29 PM, 'mechaflash213 said:

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?

msgbox(0,"",@UserName)

No, no, that's the username. Display Name is generally FName LName, but it may be different.
  • Moderators
Posted

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
Next

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

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

"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!

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...