Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Windows PowerShell
- Copyright (C) 2016 Microsoft Corporation. All rights reserved.
- PS C:\Users\Administrator> get-localuser
- Name Enabled Description
- ---- ------- -----------
- Administrator True Built-in account for administering the computer/domain
- cloudbase-init True
- DefaultAccount False A user account managed by the system.
- Guest False Built-in account for guest access to the computer/domain
- PS C:\Users\Administrator> Add-LocalGroupMember -Group Administrators -Member gheza^C
- PS C:\Users\Administrator> New-LocalUser -Name gheza -AccountNeverExpires
- cmdlet New-LocalUser at command pipeline position 1
- Supply values for the following parameters:
- Password: ********
- Name Enabled Description
- ---- ------- -----------
- gheza True
- PS C:\Users\Administrator> $pwd = "macaroana"
- PS C:\Users\Administrator> $secure = $pwd | ConvertTo-SecureString -AsPlainText -Force
- PS C:\Users\Administrator> New-LocalUser -Name gheza2 -AccountNeverExpires -Password $secure
- New-LocalUser : Unable to update the password. The value provided for the new password does not meet the length,
- complexity, or history requirements of the domain.
- At line:1 char:1
- + New-LocalUser -Name gheza2 -AccountNeverExpires -Password $secure
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : InvalidArgument: (:) [New-LocalUser], InvalidPasswordException
- + FullyQualifiedErrorId : InvalidPassword,Microsoft.PowerShell.Commands.NewLocalUserCommand
- PS C:\Users\Administrator> $pwd = "Passw0rd"
- PS C:\Users\Administrator> $secure = $pwd | ConvertTo-SecureString -AsPlainText -Force
- PS C:\Users\Administrator> New-LocalUser -Name gheza2 -AccountNeverExpires -Password $secure
- New-LocalUser : User gheza2 already exists.
- At line:1 char:1
- + New-LocalUser -Name gheza2 -AccountNeverExpires -Password $secure
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : ResourceExists: (gheza2:LocalUser) [New-LocalUser], UserExistsException
- + FullyQualifiedErrorId : UserExists,Microsoft.PowerShell.Commands.NewLocalUserCommand
- PS C:\Users\Administrator> New-LocalUser -Name gheza3 -AccountNeverExpires -Password $secure
- Name Enabled Description
- ---- ------- -----------
- gheza3 True
- PS C:\Users\Administrator> net user
- User accounts for \\WIN-1QJVGL6GS4T
- -------------------------------------------------------------------------------
- Administrator cloudbase-init DefaultAccount
- gheza gheza2 gheza3
- Guest
- The command completed successfully.
- PS C:\Users\Administrator> net user gheza3 /logonpasswordchg:yes
- The command completed successfully.
- PS C:\Users\Administrator>
Add Comment
Please, Sign In to add comment