Solved

Whoami

Posted on 2013-01-09
7
491 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
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 11

Author Comment

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

Accepted Solution

by:
als315 earned 500 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

737 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