Advertisement
Guest User

Untitled

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