Solved

How do I set default user name and domain name instead of last user logon

Posted on 2003-11-01
10
884 Views
Last Modified: 2010-04-11
    I and many of my colleagues frequently visit client's computers for various tasks. I set down login as local administrator complete my task and reboot. I don't know their passwords nor their login names and don't want to know either. Is there a way I can setup their computers so no matter who successfully logs in before the reboot the default Username has that clients username; the default domain name is the domain they log into (we have multiple domains) and the password box is left blank. NO THIRD PARTY SOFTWARE!!!!!  In some cases 3rd party software works great but I will not guarantee points to be awarded because we are not a 3rd party shop. So be warned.
0
Comment
Question by:Fubyou
[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
10 Comments
 
LVL 8

Expert Comment

by:SNilsson
ID: 9663959
0
 

Author Comment

by:Fubyou
ID: 9664268
THIS ABOVE ANSWER IS WRONG.

PLEASE AT LEAST READ THE QUESTION BEFORE ANSWERING.

0
 
LVL 26

Expert Comment

by:Soulja
ID: 9664822
Are you logging into Active Directory domains? If so, why can't the user just type in "username@domain.com" for their username. That way they won't need to select their domain.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 4

Expert Comment

by:Netelligen
ID: 9665142
Possibly I am misunderstanding what you are asking for, but I will give it a shot.

You can easily setup a script at logoff (if you are using Win2K or XP) to modify the registry.

The keys you would modify are:

HKLM/SOFTWARE/Microsoft/WindowsNT/CurrentVersion/Winlogon/DefaultUserName

and

HKLM/SOFTWARE/Microsoft/WindowsNT/CurrentVersion/Winlogon/DefaultDomainName

You could call a .reg file (like logoff.reg) that had something similar to the following in it:
-------------------------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"DefaultDomainName"="CLIENTDOMAIN"
"DefaultUserName"="clientusername"
-------------------------------------------

Let me know if this is what you were looking for

Netelligen
0
 

Author Comment

by:Fubyou
ID: 9665153
That answer was actually amusing.
0
 

Author Comment

by:Fubyou
ID: 9665158
Yea thats it Netelligen. I went to the microsoft site and downloaded some script maker. And I know I should write a script but am not sure how to write it exactlly. But you are on the right track.
0
 
LVL 4

Accepted Solution

by:
Netelligen earned 250 total points
ID: 9665208
So, here are the scripts... the first one reads the DefaultUserName and DefaultDomainName keys and creates NEW keys, called LastUser and LastDomain, with the appropriate info.  The second one reads from LastUser and LastDomain and sets the DefaultUserName and DefaultDomainName keys to those values.

getlastlogon.vbs
-------------------------------------------
Set WshShell = WScript.CreateObject("WScript.Shell")

strLastUser = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName")
strLastDomain = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName")
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LastUser", strLastUser
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LastDomain", strLastDomain

Set wshShell = nothing
-------------------------------------------

setlastlogon.vbs
-------------------------------------------
Set WshShell = WScript.CreateObject("WScript.Shell")

strLastUser = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LastUser")
strLastDomain = WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LastDomain")
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", strLastUser
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", strLastDomain

Set wshShell = nothing
-------------------------------------------

I would use the first script (getlastlogon.vbs) in the user's logon script (such as the domain logon script) and, since you are logging in locally as Administrator, you can use the second script (setlastlogon.vbs) either manually or in a logoff script for the local administrator.

Everything should then be totally automated.

Hope this helps.

Netelligen
0
 

Author Comment

by:Fubyou
ID: 9672824
The aboce code works great thank you
0
 

Author Comment

by:Fubyou
ID: 9672827
above i meant
0
 
LVL 4

Expert Comment

by:Netelligen
ID: 9673160
Not a problem.

Glad I could help :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Cross-Network Traffic 24 115
Add HP 8210 Printer to Airport Extreme with USB 5 64
hp Printer driver does not install something is blocking it not sure what 4 59
Exchange 2016 4 63
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

732 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