$domain = "abc.com"
$username = "zhangsan"
$password = ConvertTo-SecureString "2023@passwd" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
Rename-Computer -NewName $username
Add-Computer -DomainName $domain -Credential $credential
Restart-Computer


启用自动更新
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v AUOptions /t REG_DWORD /d 0 /f