Create an account that never expires and is a member of the Local administrators group from the command line

by | Oct 9, 2023 | IT Tips | 0 comments

In an Administrative cmd or powershell terminal run

1
2
3
4
5
6
7
8
9
10
# /expires:never sets account to never expire NOT password
net user toggenator2 * /add /expires:never
 
# Password never expires
wmic UserAccount where Name="toggenator" set PasswordExpires=False
# or use powershell
Get-LocalUser toggenator | Set-LocalUser -PasswordNeverExpires $true
# Add to Administrators Powershell/cmd
Add-LocalGroupMember -Member toggenator -Group Administrators
net localgroup Administrators toggenator /add

To confirm

1
net user toggenator

Output of net user command

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
User name                    toggenator
Full Name
Comment
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never
 
Password last set            5/07/2024 12:34:28 PM
Password expires             Never
Password changeable          5/07/2024 12:34:28 PM
Password required            Yes
User may change password     Yes
 
Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   Never
 
Logon hours allowed          All
 
Local Group Memberships      *Administrators       *Users
Global Group memberships     *None
The command completed successfully.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.