$csvfile = "C:\users\zahadadmin3\desktop\domain\computers.txt"
Import-Csv $csvfile | foreach {
$computer=$_.computer;
$user=$_.user;
$password=$_.password;
Function AutoAdminLogon2 {
[cmdletbinding()]
Param(
[string] $User = $(Throw 'No user id specified'),
[string] $Password = $(Throw 'No password specified')
)
$RegPath = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon'
Set-ItemProperty -Path $RegPath -Name AutoAdminLogon -Value 1
Set-ItemProperty -Path $RegPath -Name DefaultUserName -Value -user $_.user
Set-ItemProperty -Path $regPath -Name DefaultPassword -Value -password $_.password
}
}
↧
PowerShell Script: Autologon, select each computername with username and password (in csv) write into remote registry.
↧