473,382 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How do I find the user name of the person currently logged into Windows?

Seth Schrock
2,965 Expert 2GB
I'm not sure if it is possible, but I figured it was worth a shot. Is there code that can pull the user name of the user logged into Windows and use that information to populate a text box? I don't think that this will make a difference, but the user profile is stored in an Active Directory server not locally on the computer and the user then logs into the domain server.

If not I think I'm up to the task of creating the functions to setup a user function with passwords, but like I said, it would be a whole bunch simpler to just pull the user name from the current user.
Nov 1 '11 #1

✓ answered by NeoPa

Function to Return UserName (NT Login) of Current User may prove helpful. It discusses the pros and cons of a couple of methods.

4 1915
ADezii
8,834 Expert 8TB
Try:
Expand|Select|Wrap|Line Numbers
  1. Dim oNet As Object
  2.  
  3. Set oNet = CreateObject("WScript.Network")
  4.  
  5. Me![txtUserName] = oNet.UserName
Nov 1 '11 #2
NeoPa
32,556 Expert Mod 16PB
Function to Return UserName (NT Login) of Current User may prove helpful. It discusses the pros and cons of a couple of methods.
Nov 2 '11 #3
Seth Schrock
2,965 Expert 2GB
Thanks NeoPa. I ended up using the Environ() function in the forms OnCurrent event.
Nov 2 '11 #4
NeoPa
32,556 Expert Mod 16PB
That's fine Seth, and certainly the easiest approach. So long as you're aware of the level of security it represents (Not very high).
Nov 2 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sparks | last post by:
yes I tried DBEngine.Workspaces(0).UserName and this gives me a name of the current user of access. admin in my case but can I get the user login name and store it in a table? the login name of...
2
by: Homauoon | last post by:
Dear sir I want to get current user name from system (in windows applications) by using WNetGetUser function from Mpr.lib. Please help me. Thanks
0
by: Juan Manuel G?mez Ramos | last post by:
Hello: I'm using a C# component to manage windows tasks. It allows task creation providing an account name and password. The operating system will only execute the task if the account...
2
by: ChrisB4745 | last post by:
I'm working on a system service application that is supposed to report various information about the computer it is running on back to a central server. One of the things I need to know is the...
1
by: ChrisB4745 | last post by:
I'm working on a system service application that is supposed to report various information about the computer it is running on back to a central server. One of the things I need to know is the...
4
by: Ferdinand Zaubzer | last post by:
With System.Security.Principal.WindowsIdentity.GetCurrent().Name I get the user name of the current Windows user. But how can I get the full name? Thanks Ferdinand
1
by: eswanson | last post by:
How do you get the currently logged in user from a regular c sharp class? I have a common utility class in which I have some static functions that called from multiple places. In one of the...
1
by: Ronald S. Cook | last post by:
In my .NET Windows app, I'm needing to read the user name of the person logged into Windows. How can I do this? Thanks, Ron
6
by: MuZZy | last post by:
Hi, I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. For example, when i log in to my laptop from home, I'm not on the office network so...
1
by: sunil rana | last post by:
The command "finger" would only provide me the login id and the actual name of the login id.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.