Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get List of Users
- net user
- # Get List of Local Groups
- net localgroup
- # Create user "bmarley"
- net user /add bmarley S3cretP@ssword /add
- # Add BMARLEY to local administrators group
- NET LOCALGROUP "administrators" "bmarley" /add
- # Create a user account with no password
- New-LocalUser -Name "bmarley" -Description "Bob Marley's Account" -NoPassword
- # Create a user account that has a password
- $Password = Read-Host -AsSecureString
- New-LocalUser "bmarley" -Password $Password -FullName "Bob Marley" -Description "Bob Marley's account"
- # Create a user account that is connected to a Microsoft account
- New-LocalUser -Name "MicrosoftAccount\usr bmarley@Outlook.com" -Description "Bob Marley's account"
- # Use PSEXEC to add
- psexec \\RemoteComputerName net localgroup administrators "bmarley" /add
- # Powershell add local user to local admin group
- $ComputerName = "RemoteComputerName"
- $UserName = "bmarley"
- $AdminGroup = [ADSI]"WinNT://$ComputerName/Administrators,group"
- $User = [ADSI]"WinNT://$UserName,user"
- $AdminGroup.Add($User.Path)
- # Powershell remotely remove local user from local admin group
- psexec \\RemoteComputerName net localgroup administrators "bmarley" /delete
Add Comment
Please, Sign In to add comment