commit f634b77704dae4dad8873c71180d7c04276df37d Author: Donavon McDowell Date: Tue Mar 19 15:06:43 2024 -0600 Add EnableAutoLogin.ps1 diff --git a/EnableAutoLogin.ps1 b/EnableAutoLogin.ps1 new file mode 100644 index 0000000..7c94a11 --- /dev/null +++ b/EnableAutoLogin.ps1 @@ -0,0 +1,23 @@ +# By: Donavon McDowell +# Purpose: To enable microsoft 11 auto login +# +# Prompt user for username and password +Write-Host " " +Write-Host "What are the operator account credentials?" -Foreground "Blue" +Write-Host " " +$username = Read-Host "Enter the account username" +$password = Read-Host "Enter the account password" -AsSecureString + +# Convert secure string password to plain text +$passwordPlain = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password)) + +# Registry key path +$keyPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" + +# Set registry values +Set-ItemProperty -Path $keyPath -Name "DefaultUserName" -Value $username +Set-ItemProperty -Path $keyPath -Name "DefaultPassword" -Value $passwordPlain +Set-ItemProperty -Path $keyPath -Name "AutoAdminLogon" -Value 1 + +# Display confirmation +Write-Host "Registry values updated successfully."