lavascript Posted August 14, 2012 Share Posted August 14, 2012 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 More sharing options...
Mechaflash Posted August 14, 2012 Share Posted August 14, 2012 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.” Link to comment Share on other sites More sharing options...
hannes08 Posted August 15, 2012 Share Posted August 15, 2012 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 More sharing options...
lavascript Posted August 15, 2012 Author Share Posted August 15, 2012 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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 15, 2012 Moderators Share Posted August 15, 2012 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 lavascript 1 "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 More sharing options...
lavascript Posted August 15, 2012 Author Share Posted August 15, 2012 YES. That is EXACTLY what I was looking for.Thank you!I had found this:http://blogs.msdn.com/b/alejacma/archive/2008/03/04/how-to-get-the-logged-on-user-with-wmi-vbscript.aspxBut yours seems to work better. Thanks again! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 15, 2012 Moderators Share Posted August 15, 2012 Glad to be of help "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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now