?
Solved

Whoami

Posted on 2013-01-09
7
Medium Priority
?
497 Views
Last Modified: 2013-01-10
Good Day, I'm looking for VB code that will deliver the UserID/UserName as "\whoami" will do from a command prompt. Any help is appreciated.
0
Comment
Question by:EMCIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 40

Expert Comment

by:als315
ID: 38759863
Like:
Dim obj as object
Set obj = wscript.CreateObject("wscript.network")
MsgBox obj.Username
You can find also otren methods here:
http://www.robvanderwoude.com/vbstech_network_names_user.php
0
 
LVL 11

Author Comment

by:EMCIT
ID: 38759877
Thanks for the quick response. I get:

Run Time Error 424
Object Required

Dim obj As Object
Set obj = wscript.CreateObject("wscript.network")   *This line is highlighted
MsgBox obj.UserName
0
 
LVL 40

Expert Comment

by:als315
ID: 38760083
What VB is used?
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 11

Author Comment

by:EMCIT
ID: 38760095
VB 6.5 within MS Access 2003
0
 
LVL 40

Accepted Solution

by:
als315 earned 2000 total points
ID: 38760106
VBA. Next time, please, add MS Access database to topics.
You can use:
msgbox environ$("username")

In vb.net it will be:
Environment.UserName
0
 
LVL 40

Expert Comment

by:als315
ID: 38760150
You can use also almost same code as in my first comment:
Dim obj As Object
Set obj = CreateObject("wscript.network")
MsgBox obj.UserName
0
 
LVL 11

Author Closing Comment

by:EMCIT
ID: 38763265
Thanks so much. Sorry for the confusion.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question