Guest User

Untitled

a guest
Jan 3rd, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. # Get List of Users
  2. net user
  3.  
  4. # Get List of Local Groups
  5. net localgroup
  6.  
  7. # Create user "bmarley"
  8. net user /add bmarley S3cretP@ssword /add
  9.  
  10. # Add BMARLEY to local administrators group
  11. NET LOCALGROUP "administrators" "bmarley" /add
  12.  
  13. # Create a user account with no password
  14. New-LocalUser -Name "bmarley" -Description "Bob Marley's Account" -NoPassword
  15.  
  16. # Create a user account that has a password
  17. $Password = Read-Host -AsSecureString
  18. New-LocalUser "bmarley" -Password $Password -FullName "Bob Marley" -Description "Bob Marley's account"
  19.  
  20. # Create a user account that is connected to a Microsoft account
  21. New-LocalUser -Name "MicrosoftAccount\usr bmarley@Outlook.com" -Description "Bob Marley's account"
  22.  
  23. # Use PSEXEC to add
  24. psexec \\RemoteComputerName net localgroup administrators "bmarley" /add
  25.  
  26. # Powershell add local user to local admin group
  27. $ComputerName = "RemoteComputerName"
  28. $UserName = "bmarley"
  29. $AdminGroup = [ADSI]"WinNT://$ComputerName/Administrators,group"
  30. $User = [ADSI]"WinNT://$UserName,user"
  31. $AdminGroup.Add($User.Path)
  32.  
  33. # Powershell remotely remove local user from local admin group
  34. psexec \\RemoteComputerName net localgroup administrators "bmarley" /delete
Add Comment
Please, Sign In to add comment