Issue with a script

I have a script which I will post that is supposed to autologin the machines.  This is not in a GPO because I have various generic user names that I need to use so I basically just run the script with PSEXEC and hope for the best... For the most part it works with the acceptation of the times it doesn't.  the problem is the autologin registry keeps going back to 0 instead of 1.  Is there any way to prevent this from happening without having to run 30 plus gpo's with different user names?

REG DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /F

REG DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /F
REG DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /F
REG DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /F
REG DELETE "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /F

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d xxx /f

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d username /f

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d password /f

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v ForceAutoLogon /t REG_SZ /d 1 /f

REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v ForceAutoLogon /t REG_SZ /d 1 /f
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

NVITEnd-user supportCommented:
Have you tried the free Autologon by Microsoft?

Autologon is easy enough to use. Just run autologon.exe, fill in the dialog, and hit Enable. To turn off auto-logon, hit Disable. Also, if the shift key is held down before the system performs an autologon, the autologon will be disabled for that logon. You can also pass the username, domain and password as command-line arguments
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
NVIT, SysInternals AutoLogon is a manual GUI tool, not scriptable, and this question is about using a script remotely ;-).

WellingtonIS, the reg deletes are unnecessary, as you are using reg add /f, which will create or overwrite. Leaving the deletes out adds readability to the script.
Anyway, this is not the issue. If a change is reverted back, something does it. Your script looks correct, so are you certain there is no GPO resetting AutoAdminLogin?
"AutoLogon is a manual GUI tool, not scriptable" - no, it is scriptable.
autologon.exe /accepteula username domain password

Open in new window

10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Very interesting, and something I should have known ...
WellingtonISAuthor Commented:
YEs I am sure that nothing else is in the way of autologin.  Perhaps I'm explaining this wrong.  That bat files writes to the registry, I thought, that once you write to the registry that's that.  For reasons unknown that autologin key keeps changing back to 0.  We do have a script that turns it off too but once we do that we re-run the one that turns it back on.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Any other process can switch it back, so you never can really know. In the early days it has been sufficient to stop the autologin once to reset that setting to zero.
I'm certain that you will find the setting correct immediately after you have set it, but later it is off. And to know what is going on, you would have to generate an automated record of access to the registry setting for some time.

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
Simply setup auditing for that registry key and your security event log will tell you what is changing that key.
WellingtonIS, your feedback is awaited.
WellingtonISAuthor Commented:
I was able to figure it out based upon your help. thanks.  I created a GPO to change the registry key
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
Windows 7

From novice to tech pro — start learning today.