Reset Default Username on Logon Screen

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]
"DefaultUserName"="joe.bloggs"
"AltDefaultUserName"="joe.bloggs"
"AltDefaultDomainName"="business.domain"
"DefaultDomainName"="business.domain"
"CachePrimaryDomain"="business.domain"
---------------------------------------------------------------------------------- (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

client01;joe.bloggs
client02;john.smith

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?
LVL 4
mortarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Juan OcasioApplication DeveloperCommented:
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.

HTH

jocasio
0
mortarAuthor Commented:
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?
0
grayeCommented:
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:
http://www.dpw.hood.army.mil/ftp/UserRestore
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mortarAuthor Commented:
thanks graye, I'll look forward to it :)
0
grayeCommented:
it's there now...
0
mortarAuthor Commented:
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?
0
grayeCommented:
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.
0
mortarAuthor Commented:
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?
0
grayeCommented:
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)
0
mortarAuthor Commented:
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?
0
grayeCommented:
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
     c:\somepath\UserRestore.exe

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
0
mortarAuthor Commented:
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!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.