Reset Default Username on Logon Screen

Posted on 2005-03-16
Medium Priority
Last Modified: 2008-01-09
Hi, I log on to several different machines in a small office environment and I was wondering if it was possible to reset the "default username" on logon, to the computer's default each time I log out.  I.e. one person most of the time uses just the one machine, so it's easier then changing the last used, and retyping.

For instance:

We have 13 machines, each named client01, client02 etc to client13

Client01 for instance, the main username is joe.bloggs, client02 is john.smith.  If I come along and log on as ITAdmin, when I log out, my username will still be there, but I want to know if it is possible, to reset it back to joe.bloggs if on the client01 machine or john.smith if on the Client02 machine automatically.

I basically have the REG File done up already that changes what I need:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
---------------------------------------------------------------------------------- (are all of these lines necessary?)

And i'd assume i'd also keep the central user list on the server somewhere i.e. M:\loginlist.txt


I can pull the %computername% variable from the OS and validate it using the loginlist.txt file. Is there anyway to feed it into the registry file?
I'd prefer to do it with just the one registry file is possible i.e. "AltDefaultUserName" = %username%

Is this the right way to go about it? Can anyone help me to complete the few remaining steps or show me an easier way to accomplish this?
Question by:mortar
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
  • 6
  • 5
LVL 14

Expert Comment

by:Juan Ocasio
ID: 13561459
Usually there really in no way to do this.  You could set a group policy to not show any users (which is more secure that having the last person who logged on displayed).  However, looking at what you are doing, what you could probably do is create a group policy that runs a script on log off that will run a .reg file on the person's machine (tucked somewhere say C:\defaultUser.reg)that way, whenever a user logs off, it will run the script, which in turn will update the registry with the values.  One caveat to this however is the user who is logging off will have to have admin right on the box, otherwise they will not be able to mod the registry.



Author Comment

ID: 13561547
Admin rights aren't a problem as my username has admin rights to the system, and I only want this process to occur for my username only, and no other usernames.

I've done basically all the steps automatically already up until the point of the registry files, so my solution would work with multiple reg files, I just wanted to know if there was a way to do it just with one, or an easier way to do the whole process.  I don't think group policies will work too well because they're normally for all users aren't they?
LVL 41

Accepted Solution

graye earned 2000 total points
ID: 13561839
I've got a program that does exactly what you want...  

It's called RestoreUser and is placed in the Login batch of our Administrator's accounts.   So, whenever an Admin logs into a local PC, this program runs automatically and resets the default user/domain when the session ends.

It's available as VB.Net source code only (so you'll have to compile it yourself)...

I don't have it on our FTP server right this second (not exactly sure why...)   So, I'll put it there in the morning.  The URL will be:
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


Author Comment

ID: 13562651
thanks graye, I'll look forward to it :)
LVL 41

Expert Comment

ID: 13565079
it's there now...

Author Comment

ID: 13618458
Can I compile it as an EXE file for redistribution on another PC as I don't have .Net installed on any of the computers in question..? If so, how?
LVL 41

Expert Comment

ID: 13618629
Let me see if I understand...

Yes, you must have either Visual Studio .Net (you can get a 60-day free trial at http://msdn.microsoft.com/vstudio/productinfo/trial/default.aspx) or the .Net Software Development Kit (http://www.microsoft.com/downloads/details.aspx?FamilyId=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en) installed on at least one PC in order to compile the program as an EXE.

In addition to that, all PCs must have the .Net framework installed (but chances are they already have it installed...)

One of the selling points about .Net is that the applications don't need to be installed... the EXE can simply be copied to the local PC via login batch file and run from that local directory.

Author Comment

ID: 13618791
I've got visual studio.net but i'm a Visual Basic 6.0 programmer, so it's all a bit new to me.  I've built the program and tested it using F5, but couldn't find a place to make an EXE file similiar to how you make one using the file menu of Visual Basic 6.0 so I just grabbed it out of the bin folder in the source directory.

Is there any repercussions to installing the .Net Framework? I.e. computer runs slower, takes up too much space, any other problems?
LVL 41

Expert Comment

ID: 13627729
Getting the files from the bin folder is exactly what I do... I hardly ever go to the bother of creating an install package.  There should be 2 or 3 files in there (depending on whether you compiled with the debug option).  All of those files should be copied to the target PCs (we do it with a login batch file)

Most "modern" PCs should already have the .Net Framework by now... it's been available via the microsoft Update site for over 2 years (as an optional component).   Besides, you probably already have .Net applications installed (like Norton Antivirus) and therefore already have the .Net framework

No, I wouldn't expect any issues with installing the .Net Framework v1.1... there are a few security updates after you do an install, so I just tell folks to run the usual Microsoft updates from the web site.

Welcome to the brave new .Net world !

By the way... Microsoft support for VB6 officially ends on 31 March (a week from today)

Author Comment

ID: 13666892
Sorry but still stepping through it.  I installed the framework but receive the following error:

The application attempted to perform an operation not allowed by the security policy.  The operation required the SecurityException.  To grant this application the required permission please contact your system administrator, or use the Microsoft .NET security policy administration tool.

If you click Continue, the application will ignore this error and attempt to continue.  if you click Quit, the application will be shut down immediately.

Request Failed

Should I attempt to create a system policy?  This is the only .NET application that I wish to run for the time being.  Will I have to repeat this process for all 13 computers?
LVL 41

Expert Comment

ID: 13667411
I had suggested that you copy the program's files (from the bin directory on your development PC) to each client PC with a login batch file (or some other method).

The .Net framework assigns different security policies to programs that are run locally vs. those that are run via a network share.   So, you essentially have two choices...  copy the files (so that the program is under the "local" security policy) or alter the security policy for the local intranet to allow for the program to run.

The simple solution is to copy the file...   We use something like this in our adminitrator's login batch to 1) copy the files to the local PC if they don't already exist, 2) update the files if they do already exist, 3) run the program

     replace \\someserver\someshare\somepath\UserRestore.* c:\somepath /u
     replace \\someserver\someshare\somepath\UserRestore.* c:\somepath /a

BTW: You've got 2 days until the official end of support for VB6.   I wouldn't wait much longer to be starting to learn VB.Net

Author Comment

ID: 13667756
Sorry I forgot your post from the other day.. Makes sense now ;)

Ran it locally and it worked fine!

Thank you very much for your input, fantastic little program.

Keep up the good work, i'll get into VB.Net this weekend!

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes
Suggested Courses

801 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