Advertisement
Guest User

Untitled

a guest
May 18th, 2018
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Sets Autologin for scripts
  2. $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
  3. $DefaultUsername = Read-Host -Prompt "User's O365 Cred"
  4. $DefaultPassword = Read-Host -Prompt "User's O365 Pass"
  5. Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String
  6. Set-ItemProperty $RegPath "DefaultUsername" -Value "$DefaultUsername" -type String
  7. Set-ItemProperty $RegPath "DefaultPassword" -Value "$DefaultPassword" -type String
  8.  
  9.  
  10. #Reboots and starts next script
  11. $RunOnceKey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce"
  12. set-itemproperty $RunOnceKey "NextRun" ('C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe  -File ' + "~\Downloads\systemrename.ps1")
  13. Start-Sleep 10
  14. Restart-Computer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement