Set-Autologon.ps1
function Set-Autologon { <# .SYNOPSIS Configures Autologon through the Registry. .DESCRIPTION You can set the Autologon-key so that the Machines does not need manual logon. Can be used for automatic Configuration after Installation. .EXAMPLE Set-Autologon -Logonuser "Hans" -Password Test1234 -Domain "Netz-weise.de" .NOTES Author: Holger Voges Version: 1.0 Date: 2018-08-17 .LINK https://www.netz-weise-it.training/ #> [CmdletBinding()] param ( # The Username with which to log on [string] $LogonUser, # The Password as string [string] $Password = 'Passw0rd', # The Default-Domain [string] $Domain = 'netz-weise.de' ) # todo: müssen noch um eine Überpüfung und einen new-item / set-item erweitert werden Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'AutoAdminlogon' -Value 1 -Type String Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultUserName' -Value $LogonUser -Type String Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultPassword' -Value $Password -Type String Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'DefaultDomainName' -Value $Domain -Type String } |