NET

ACCOUNTS / NET USER / NET GROUP

Usage

NET ACCOUNTS  [/FORCELOGOFF:{minutes | NO} ] [/MINPWLENGTH:length]
             [/MAXPWAGE:{days | UNLIMITED}] [/MINPWAGE:days] [/UNIQUEPW:number] [/DOMAIN]

Examples ACCOUNTS

View the local password & logon policy.
NET ACCOUNTS
View the domain password & logon policy.
NET ACCOUNTS /DOMAIN
Set passwords to never expire.
NET ACCOUNTS /MAXPWAGE:UNLIMITED /DOMAIN

Examples USER

View the password properties of user account ‘Ella’
NET USER Ella
View user account details
NET USER [/DOMAIN]
Add a user account.
NET USER username {password | *} /ADD [options] [/DOMAIN]
Modify a user account.
NET USER [username [password | *] [options]] [/DOMAIN]
Delete a username
NET USER username /DELETE [/DOMAIN]

Examples GROUP

Add a group to domain
NET GROUP groupname /ADD /DOMAIN
Add a group to local
NET LOCALGROUP groupname /ADD 
Edit a domain group
NET GROUP groupname /DOMAIN
NET LOCALGROUP groupname
Delete a domain group
NET GROUP groupname /DELETE [/DOMAIN]
NET LOCALGROUP groupname /DELETE
Add a user to a group
NET GROUP groupname username [...] /ADD /DOMAIN
NET LOCALGROUP groupname username [...] /ADD
Delete a user from a group
NET GROUP groupname username [...] /DELETE /DOMAIN
NET LOCALGROUP groupname username [...] /DELETE

Examples FILE

Show all open shared files
NET FILE

Examples SESSION

List all sessions to this machine
NET SESSION

Examples services

List running services
NET START
Stop and start service
NET STOP <SERVICE> && NET START <SERVICE>

Examples SHARE

Display the details of all local shares
NET SHARE
Create a new share
NET SHARE <sharename>=C:\path\to\folder /REMARK:"comment" /CACHE:No
Limit the number of users who can connect to a share
NET SHARE <sharename> /USERS:15
Remove any limit on the number of users who can connect to a share
NET SHARE <sharename> /UNLIMITED
Delete a share
NET SHARE <sharename> /DELETE

Examples USE

Map a file share
NET USE J: \\MainServer\Users\
Disconnect from a share
NET USE J: /DELETE /Y
Map a drive using alternate credentials (PowerShell)
PS C:\> $SecString = "s5QxXkwnOxt3MuNlgY6E" | ConvertTo-SecureString -AsPlainText -Force
PS C:\> $cred = New-Object System.Management.Automation.PsCredential('DOMAIN\user',$SecString)
PS C:\> New-PSDrive -name G -Root \\Server64\Share1 -Credential $cred -PSProvider filesystem -Persist

Examples VIEW

Display a list of computers in the current domain
NET VIEW
List the File/Printer shares on a remote computer
NET VIEW \\ComputerName
List all the shares in the domain
NET VIEW /DOMAIN

List of shares on a different domain

NET VIEW /DOMAIN:domainname

Also see

N/A