Jump to content
Sign in to follow this  
lavascript

Querying the Display Name without AD

Recommended Posts

lavascript

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?

Share this post


Link to post
Share on other sites
Mechaflash

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)

Spoiler

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

 

Share this post


Link to post
Share on other sites
hannes08

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]

Share this post


Link to post
Share on other sites
lavascript

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
JLogan3o13

Glad to be of help :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • water
      By water
      ADAT is a tool to simplify common AD administration tasks. Every administration task has its own tab. It is easy to add new functions (tabs) to the tool. Some often used functions are already available: list users, computers, OUs. File ADAT.ini can be customized to hold the AD logon information if necessary.
      Known Bugs:
      2018-03-07: If the Script started from SciTE works but the "Process" button in the compiled exe does not do anything then please add the following line at the top of your script:
      #Au3Stripper_Ignore_Funcs=Process_Tab*
        BTW: If you like this tool please click the "I like this" button. This tells me where to next put my development effort
    • bouzzi
      By bouzzi
      Hi guys,
      I'm trying to make a script that could tell me, from a username list file,  if the username is active, inactive or not existant  in a multi-domain Active Directory....
      I found a few scripts giving me hints but I found nothing to help me to accomplish this task...
      Do you have any ideas !
      Thanks
      Bouzzi!
       
    • water
      By water
      Extensive library to control and manipulate Microsoft Active Directory.

      Threads: Development - General Help & Support - Example Scripts - Wiki
       
      Known Bugs: (last changed: 2018-02-02)
      When used with AutoIt 3.3.14.3. (or later) you need to insert the following line to the UDF. This is caused by functions being moved to a new WinAPI UDF.
      #include <WinAPIConv.au3> ; Needed for AutoIt >= 3.3.14.3
       
      BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort
    • water
      By water
      On one/multiple big sheet(s) you get users (columns) and groups (rows). The list is sorted descending by number of members so you get the users with most groups and the groups with most members on top of the page. You can filter by (multiple) samaccountname(s), department or you can create your own LDAP query filter. You can filter the resulting list of groups using a Regular Expression.
      Version 2.0 uses maps so at the moment it requires the latest beta version of AutoIt!
      BTW: If you like this tool please click the "I like this" button. This tells me where to next put my development effort
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.