Deploy a Registry change

Comments

21 comments

  • Stephen Valdinger

    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.

    0
    Comment actions Permalink
  • Brent Green

    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?

    0
    Comment actions Permalink
  • Stephen Valdinger

    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

    0
    Comment actions Permalink
  • Stephen Valdinger

    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

    0
    Comment actions Permalink
  • Brent Green

    Thanks, I got it set up.  How is the best way to deploy with PDQ? 

    0
    Comment actions Permalink
  • Brent Green

    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

    0
    Comment actions Permalink
  • Brent Green

    BTW, we use Deep Freeze too.  So the procedure would be the same for us.

    0
    Comment actions Permalink
  • Stephen Valdinger

    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.

    0
    Comment actions Permalink
  • Stephen Valdinger

    Well, I thought it attached. Trying this again! haha.

    0
    Comment actions Permalink
  • Brent Green

    I'm not seeing the screenshot.  xxxx is just what is showing on the screen.  I'll drop that and try it.

    0
    Comment actions Permalink
  • Brent Green

    Now it's there!

    0
    Comment actions Permalink
  • Brent Green

    Everything is working now.....except that it is not Auto-logging in after the reboot.  Any ideas?

    0
    Comment actions Permalink
  • Stephen Valdinger

    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.

    0
    Comment actions Permalink
  • Brent Green

    There is nothing in Windows NT\Currentversion that says winlogon.  Also, my test machine doesn't have Deep Freeze on it.

    0
    Comment actions Permalink
  • Stephen Valdinger

    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.

    0
    Comment actions Permalink
  • Brent Green

    7 Professional

    0
    Comment actions Permalink
  • Stephen Valdinger

    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.

    0
    Comment actions Permalink
  • Brent Green

    Sorry found the winlogon.  Everything is there, but the username is wrong.  It has a different name.

    0
    Comment actions Permalink
  • Stephen Valdinger

    If default domain is set properly and the username includes the domain\ portion, just drop it for only the username and redeploy.

    0
    Comment actions Permalink
  • Brent Green

    I dropped the username portion and it still didn't work.  Here is a screenshot.  It should be student where it says "Techie"

    0
    Comment actions Permalink
  • Stephen Valdinger

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.