Deploy a Registry change
I am trying to deploy a registry change. The change is for an auto logon for student computers to the student profile. I can't seem to get it to work on my test machine. It works fine when it is run manually. Any ideas? Here is the command:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"AutoAdminLogon"=dword:00000001
"DefaultUserName"="Student"
"DefaultPassword"="xxxxxxx"
"DefaultDomainName"="xxxx.k12.nm.us"
Thanks for the help!
Comments
I actually have a powershell script written that does this exact thing. We have a use case where we need to have a lab auto-login for special events sometimes, so we PDQ this to them, and then another powershell script reverts the changes. happy to provide the script to you if you would like. Redacting all of my specific information of course.
That would be great! We want these student computers to always login, but that would be nice to use when we have other groups come in as well. How do you want to get the info to me?
I'll just add my code here for the benefit of the comunity. Just copy and paste this into a new file and call it something relevant with a .ps1 extension. I used Install-Autologon.ps1. For the package I created 2 steps. Step 1 is the script. When you select the ps1 the command line should look like this: powershell.exe -NoLogo -NonInteractive -ExecutionPolicy Bypass -File "Install-AutoLogin.ps1". If it doesn't, just click custom and copy/paste this into it and change the filename to whatever you used.
The second step is just a Reboot step. When it reboots it should auto-login!
Caveat: Here we use Deep Freeze so our machines are in a frozen state. Before I execute this I have to make sure they are "thawed" so the changes from the script actually stick, other wise they ignore and modifications and reboot in their original state. So, if you employ some kind of software like that just make sure the OS is writable to these kinds of changes across reboots.
Here is the code:
Function Install-AutoLogon {
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name AutoAdminLogon -Value 1
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name DefaultUserName -Value <#domain\username#> -Type String
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name DefaultPassword -Value <#password here#> -Type String
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name DefaultDomain -Value <#domain here#> -Type String
}
Install-AutoLogon
#EOF
I should note, if you are unfamiliar with powershell <# #> denotes a multiline comment, or a way to wrap text in a comment, similar to HTML. So when you change the values in the script above be sure to remove everything including the <# #> around the text
Example: <# password here #> would become yourpassword
Thanks, I got it set up. How is the best way to deploy with PDQ?
I hope this looks correct:
Function Install-AutoLogon
{
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name AutoAdminLogon -Value 1
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name DefaultUserName -Value xxxx.k12.nm.us\Student -Type String
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name DefaultPassword -Value xxxxxxx -Type String
new-itemproperty -path "HKLM:\software\microsoft\Windows NT\currentversion\winlogon" -Name DefaultDomain -Value xxxx.k12.nm.us -Type String
}
Install-AutoLogon
#EOF
BTW, we use Deep Freeze too. So the procedure would be the same for us.
I've attached a screenshot of my package settings. Just duplicate them changing the file names. As for your format in your script Is that domain name actually what you are logging into? xxxxx.k12.nm.us? Or is just what is xxxx shown on the screeen? I'd drop the .k12.nm.us portion and just use the short name. If it fails, add it in, but I bet you don't need all that.
Well, I thought it attached. Trying this again! haha.
I'm not seeing the screenshot. xxxx is just what is showing on the screen. I'll drop that and try it.
Now it's there!
Everything is working now.....except that it is not Auto-logging in after the reboot. Any ideas?
On the machine you deployed the script to can you check the registry and see that your changes were actually made? If they were, reboot the machine again and see what happens. Did you remember to thaw the machine before you pushed the package to it? I can't tell you how many times I've done that around here.....haha.
There is nothing in Windows NT\Currentversion that says winlogon. Also, my test machine doesn't have Deep Freeze on it.
Whaaaa? What version of windows is this? I just exported a reg key from my windows 8.1 machine here and I have it.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
That's strange as hell.
7 Professional
Win 7 definitely has it as well. We use that OS here too, and Autologin works just fine with them. I'd be interested to see what you have in the registry of that machine at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion] if you can post a screenshot.
Sorry found the winlogon. Everything is there, but the username is wrong. It has a different name.
If default domain is set properly and the username includes the domain\ portion, just drop it for only the username and redeploy.
I dropped the username portion and it still didn't work. Here is a screenshot. It should be student where it says "Techie"
The default domain looks awful long. it's appending the k12.nm.us portion to the name it seems. Is your script doing that?
Delete the values in the keys from the script from the registry and redeploy to it.