MuratYildirimoglu

Resetting Local Administrator Passwords

May 12th, 2021
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. if (test-path \\servername\ortak\$env:computername.txt)
  2.  
  3. {#doNothing} else
  4.  
  5. {
  6.  
  7. $punc = 46..46
  8.  
  9. $digits = 48..57
  10.  
  11. $letters = 65..90 + 97..122
  12.  
  13. $YouShallNotPass = get-random -count 15 `
  14.  
  15. -input ($punc + $digits + $letters) |
  16.  
  17. % -begin { $aa = $null } `
  18.  
  19. -process {$aa += [char]$_} `
  20.  
  21. -end {$aa}
  22.  
  23. net user administrator $YouShallNotPass
  24.  
  25. “OK” | out-file \\servername\ortak\$env:computername.txt
  26.  
  27. $env:computername | out-file \\servername\ortak\list.txt -append
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment