Link to home
Start Free TrialLog in
Avatar of dougstech
dougstechFlag for United States of America

asked on

VBS file to modify registry

I am looking to create a simple .vbs file that will modify a registry key. I need it to have a prompt to change one key, and automatically change the other key.

The keys are
hkey_local_machine>software>microsoft>windows nt>winlogon>defaultusername
hkey_local_machine>software>microsoft>windows nt>winlogon>defaultdomainname

I need a simple prompt that will ask me for the defaultusername, and when I enter it, it will change the key with my value. And, I need it to always change the defaultdomainname to "MCPS".

I have never programmed, and I am not even sure if this is the correct way to do this. Thanks for your help!
ASKER CERTIFIED SOLUTION
Avatar of Hubasan
Hubasan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Although hubasan's code appears to be correct, I would HIGHLY advise you not do this.  Storing default domain/user/password information in the registry is a big security hole.  That means that booting the computer (by anyone) will log it in and then the user could navigate to that key to get the users's password.

I realize that you can't do this with vbs, but it's a better setup to use xp power toys to do your auto login as it won't store the PW in cleartext.

http://www.windowsreference.com/windows-xp/enable-autologon-in-windows-2000xp2003/
Avatar of dougstech

ASKER

BrandonGalderisi

the script does NOT have a password to be stored in the registry. the user will still have to enter their password, but the username and domain would be filled in for them.
I BELIEVE... the defaultusername and defaultdomainname are only used for auto login when the autologin flag is set.  I believe that the defaultusername and defaultdomainname will still always display the last logged in user.  

But I could be wrong.
Thank you so much! It worked perfectly! This saves me a TON of time in the registry! thanks again
you are welcome :-)