Net command

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]

Generate a random password:

NET USER administrator /random

Add a Workgroup
NET GROUP groupname /ADD [/COMMENT:”text”] [/DOMAIN]

Edit a workgroup
NET GROUP [groupname [/COMMENT:”text”]] [/DOMAIN]

Delete a group
NET GROUP groupname /DELETE [/DOMAIN]

Add a user to a group
NET GROUP groupname username […] /ADD [/DOMAIN]

Delete a user from a group
NET GROUP groupname username […] /DELETE [/DOMAIN]

Examples

Create a group

C:>NET LOCALGROUP spud /add

Add to guests

C:>NET LOCALGROUP guests spud /add

Then remove

C:>NET LOCALGROUP guests spud /delete

C:>NET LOCALGROUP spud /delete

– Net use command

– Net share command

Net use command

Net use

net use [drive]: [“UNC path, eg: \servershare”] [password] /user:[domainusername]

Net share command

NET SHARE sharename = drive:path /users: number | /unlimited /remark: “text”

NET SHARE
sharename
sharename=drive:path [/GRANT:user,[READ | CHANGE | FULL]]
[/USERS:number | /UNLIMITED] 設置可同時訪問共享資源的最大用戶數
[/REMARK:”text”]
[/CACHE:Manual | Documents| Programs | BranchCache | None]
sharename [/USERS:number | /UNLIMITED]
[/REMARK:”text”]
[/CACHE:Manual | Documents | Programs | BranchCache | None]
{sharename | devicename | drive:path} /DELETE
sharename \computername /DELETE

ShareName
Specifies the name of the shared resource as it should display on the network.

Drive:Path
Defines the absolute path of the directory to be shared.

/remark:Text
Adds a description about the resource. Do not forget to enclose it in quotation marks.

/users:Number
Used to set the maximum number of users who can simultaneously access the shared resource.

/unlimited
This setting specifies an unlimited number of users who can simultaneously access the shared resource.

/cache:manual
Enables offline client caching with manual reintegration.

/cache:automatic
Enables offline client caching with automatic reintegration.

/cache:documents
Enables automatic caching of documents from this share.

/cache:programs
Enables automatic caching of documents and programs.

/cache:no
Disables caching.

/delete
Stops sharing the shared resource.

more on this link

other net commands

NET GROUP Add a Workgroup
NET GROUP [GROUP_NAME] /ADD [/COMMENT:”TEXT”] [/DOMAIN] 

Edit a workgroup
NET GROUP [GROUP_NAME [/COMMENT:”TEXT”]] [/DOMAIN]

Delete a group
NET GROUP [GROUP_NAME] /DELETE [/DOMAIN]

Add a user to a group
NET GROUP [GROUP_NAME] [USERNAME] […] /ADD [/DOMAIN]

Delete a user from a group
NET GROUP [GROUP_NAME] [USERNAME] […] /DELETE [/DOMAIN]

To View, Add or modify a local workgroup replace GROUP in the commands above with LOCALGROUP.

NET HELP Displays information about NET commands and error messages. 

COMMAND /?
NET HELP [2ND _WORD]
NET HELP ERROR_NUM

COMMAND /? Specifies the Microsoft NET command that you want information about.
2ND _WORD Specifies the second word of the command you want  information about. For example, the 

suffix of  NET VIEW is VIEW.

ERROR_NUM Specifies the number of the error message that you want information about.
NET LOCALGROUP NET LOCALGROUP [GROUP_NAME [/COMMENT:”TEXT”]] [/DOMAIN] 

NET LOCALGROUP [GROUP_NAME /ADD [/COMMENT:”TEXT”]] | /DELETE} [/DOMAIN]

NET LOCALGROUP [GROUP_NAME ] [NAME] […] {/ADD | /DELETE} [/DOMAIN]

NET PASSWORD Changes your logon password. 

NET PASSWORD [OLD_PASS [NEW_PASS]] For changing the password for your  password-list file.
NET PASSWORD \COMPUTER | /DOMAIN:name [USER [OLD_PASS[NEW_PASS]]] For changing your

password on a Windows NT or LAN Manager server or domain.

OLD_PASS Specifies your current password.
NEW_PASS Specifies your new password. It can have as many as 14 characters.
COMPUTER Specifies the Windows NT or LAN Manager server on which you want to change your password.
/DOMAIN Specifies that you want to change your password on a Windows NT or LAN Manager domain name Specifies the Windows NT or LAN Manager domain on which you want to change your password.
USER Specifies your Windows NT or LAN Manager user name.