Add EnableAutoLogin.ps1
This commit is contained in:
commit
f634b77704
23
EnableAutoLogin.ps1
Normal file
23
EnableAutoLogin.ps1
Normal file
@ -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."
|
Loading…
Reference in New Issue
Block a user