Skip to main content

Net User Examples

Local User

The command net user is the same as the PowerShell command Get-LocalUser.

Command for cmd
net user locadmin
Command for PowerShell
Get-LocalUser locadmin
Example
PS C:\Windows\system32> Get-LocalUser locadmin

Name     Enabled Description
----     ------- -----------
Locadmin True    Built-in account for administering the computer/domain


PS C:\Windows\system32> net user locadmin
User name                    Locadmin
Full Name
Comment                      Built-in account for administering the computer/domain
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            10/13/2022 2:52:21 AM
Password expires             10/13/2023 2:52:21 AM
Password changeable          10/14/2022 2:52:21 AM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   10/16/2022 11:43:57 AM

Logon hours allowed          All

Local Group Memberships      *Administrators
Global Group memberships     *None
The command completed successfully.

PS C:\Windows\system32>

Domain User

The command net user /domain is the same as the PowerShell command Get-ADUser.
However, Get-ADUser can only be run in the Domain Controller.

Command for cmd
net user /domain rach01
Command for PowerShell
Get-ADUser rach01
Example
PS C:\Windows\system32> Get-ADUser rach01

DistinguishedName : CN=rara zzz,OU=Users,OU=MilkyWay,DC=homelab,DC=local
Enabled           : True
GivenName         : rara
Name              : rara zzz
ObjectClass       : user
ObjectGUID        : e9f55685-3dec-4143-a238-5f6f98fba383
SamAccountName    : rach01
SID               : S-1-5-21-2730233804-1460224074-2389028099-1105
Surname           : zzz
UserPrincipalName : [email protected]


PS C:\Windows\system32> net user /domain rach01
User name                    rach01
Full Name                    rara zzz
Comment                      Dummy User #1
User's comment
Country/region code          000 (System Default)
Account active               Yes
Account expires              Never

Password last set            7/2/2023 2:11:58 PM
Password expires             Never
Password changeable          8/2/2023 2:11:58 PM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   31/12/2023 1:23:54 AM

Logon hours allowed          All

Local Group Memberships      *Homelab2_AL          *Remote Desktop Users
Global Group memberships     *Domain Users
The command completed successfully.

PS C:\Windows\system32>