Created
January 3, 2019 17:39
-
-
Save SevenLayerJedi/d89b9815059bc8af4bbb8351c5ed8cf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment