Operating system commands windows

Net Commands On Operating Systems

This article provides some information about Net Commands on Operating Systems.

Original product version: В Windows Server 2012 R2
Original KB number: В 556003

This article was written by Nirmal Sharma, Microsoft MVP.

Summary

The following knowledgebase will explain the uses of Net commands in Windows Operating Systems.

More information

Net Commands On Windows Operating Systems

The following Net Commands can be used to perform operations on Groups, users, account policies, shares, and so on.

ACCOUNTS
COMPUTER
CONFIG
CONTINUE
FILE
GROUP
HELP
HELPMSG
LOCALGROUP
NAME
PAUSE
PRINT
SEND
SESSION
SHARE
START
STATISTICS
STOP
TIME
USE
USER
VIEW

The «Net Accounts» command is used to set the policy settings on local computer, such as Account policies and password policies. This command can’t be used on domain controller. This command is only used on local computer.

When you type Net Accounts, you will see the default settings of the Account Lockout policy and Password Policy in local computer show as:

Force user logoff how long after time expires?: Never
Minimum password age (days): 1
Maximum password age (days): 90
Minimum password length: 8
Length of password history maintained: 5
Lockout threshold: 4
Lockout duration (minutes): 4
Lockout observation window (minutes): 4
Computer role: WORKSTATION

The above settings displayed as per the role of the computer. If computer is joined to a domain, the domain settings will take effect and only the settings coming from domain will be displayed. The rest settings will be the local settings if it’s not coming from the Domain GPO.

You can change the following use the following options in Net Accounts option:

Two conditions are required in order for options used with NET ACCOUNTS to take effect:

/FORCELOGOFF: Sets the number of minutes a user has before being forced to log off when the account expires or valid logon hours expire. NO, the default, prevents forced logoff.

/MINPWLEN:length Sets the minimum number of characters for a password. The range is 0-14 characters; the default is six characters.

/MAXPWAGE: Sets the maximum number of days that a password is valid. No limit is specified by using UNLIMITED. /MAXPWAGE can’t be less than /MINPWAGE. The range is 1-999; the default is 90 days.

/MINPWAGE:days Sets the minimum number of days that must pass before a user can change a password. A value of zero sets no minimum time. The range is 0-999; the default is zero days. /MINPWAGE can’t be more than /MAXPWAGE.\

/UNIQUEPW:number Requires that a user’s passwords be unique through the specified number of password changes. The maximum value is 24.

/DOMAIN Performs the operation on a domain controller of the current domain. Otherwise, the operation is performed on the local computer.

Community Solutions Content Disclaimer

MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED «AS IS» WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Читайте также:  Как восстановить рабочий стол после переустановки windows

Windows commands

All supported versions of Windows (server and client) have a set of Win32 console commands built in.

This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.

Prerequisites

The information that is contained in this topic applies to:

  • Windows Server 2019
  • Windows Server (Semi-Annual Channel)
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2
  • Windows Server 2008
  • Windows 10
  • Windows 8.1

Command shell overview

The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all Commands that are available at the command line.

Windows has two command shells: The Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.

PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.

You can also download and install PowerShell Core, the open source version of PowerShell.

Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.

To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:

To set the reg_DWOrd value, use the hexadecimal value of a control character for a particular function (for example, 0 9 is Tab and 0 08 is Backspace). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Command-line reference A-Z

To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

Net Command

Use ‘net’ to manage a network from the Command Prompt in Windows

The net Command Prompt command manages almost any aspect of a network and its settings, including network shares, network print jobs, and network users.

Читайте также:  Windows old access denied

Net Command Availability

The net command is available from within the Command Prompt in all Windows operating systems including Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP.

The availability of certain net command switches and other net command syntax may differ from operating system to operating system.

Net Command Syntax

The command takes the following general form:

Learn how to read command syntax if you’re not sure how to interpret the net command syntax shown above or described below.

The net accounts command is used to set password and logon requirements for users. For example, the net accounts command can be used to set the minimum number of characters that users can set their password to. Also supported is password expiration, minimum number of days before a user can change their password again, and the unique password count before the user can use the same old password.

Net name is used to add or delete a messaging alias at a computer. The net name command was removed in conjunction with the removal of net send beginning in Windows Vista. See the net send command for more information.

Net print is used to display and manage network print jobs. The net print command was removed beginning in Windows 7. According to Microsoft, the tasks performed with net print can be performed in Windows 10, Windows 8, and Windows 7 using the prnjobs.vbs and other cscript commands, Windows PowerShell cmdlets, or Windows Management Instrumentation (WMI).

Net send is used to send messages to other users, computers, or net name created messaging aliases. The net send command is not available in Windows 10, Windows 8, Windows 7, or Windows Vista but the msg command accomplishes the same thing.

The net use command is used to display information about shared resources on the network that you’re currently connected to, as well as connect to new resources and disconnect from connected ones.

In other words, the net use command can be used to show the shared drives you’ve mapped to as well as allow you to manage those mapped drives.

The net helpmsg is used to display more information about the numerical network messages you might receive when using net commands. For example, when executing net group on a standard Windows workstation, you’ll receive a 3515 help message. To decode this message, type net helpmsg 3515 which displays «This command can be used only on a Windows Domain Controller.» on screen.

Net Command Options
Option Explanation
net Execute the net command alone to show information about how to use the command which, in this case, is simply a list of the net subset commands.
accounts
computer The net computer command is used to add or remove a computer from a domain.
config Use the net config command to show information about the configuration of the Server or Workstation service.
continue The net continue command is used to restart a service that was put on hold by the net pause command.
file Net file is used to show a list of open files on a server. The command can also be used to close a shared file and remove a file lock.
group The net group command is used to add, delete, and manage global groups on servers.
localgroup The net localgroup command is used to add, delete, and manage local groups on computers.
name
pause The net pause command puts on hold a Windows resource or service.
print
session The net session command is used to list or disconnect sessions between the computer and others on the network.
share The net share command is used to create, remove, and otherwise manage shared resources on the computer.
start The net start command is used to start a network service or list running network services.
statistics Use the net statistics command to show the network statistics log for the Server or Workstation service.
stop The net stop command is used to stop a network service.
time Net time can be used to display the current time and date of another computer on the network.
use
user The net user command is used to add, delete, and otherwise manage the users on a computer.
view Net view is used to show a list of computers and network devices on the network.
helpmsg
/? Use the help switch with the net command to show detailed help about the command’s several options.

Save to a file whatever a net command shows on screen using a redirection operator with the command. Learn how to redirect command output to a file or see our list of command prompt tricks for more tips.

Only in Windows NT and Windows 2000 was there a difference in the net command and the net1 command. The net1 command was made available in these two operating systems as a temporary fix for a Y2K problem that affected the net command.

Net Command Examples

This is one of the simplest net commands that lists all the networked devices.

In the above example, I’m sharing the Z:\Downloads folder with everyone on the network and giving all of them full read/write access. You could modify this one by replacing FULL with READ or CHANGE for those rights only, as well as replace everyone with a specific username to give share access to just that one user account.

This example of the net accounts command forces a user’s password to expire after 180 days. This number can be anywhere from 1 to 49,710, or UNLIMITED can be used so that the password never expires. Default is 90 days.

The above net command example is how you’d stop the Print Spooler service from the command line. Services can also be started, stopped, and restarted via the Services graphical tool in Windows (services.msc), but using the net stop command lets you control them from places like Command Prompt and BAT files.

Executing the net start command without any options following it (e.g. net start «print spooler») is useful if you want to see a list of currently running services. This list can be helpful when managing services because you don’t have to leave the command line to see which services are running.

The net commands are network-related commands and so may often be used for troubleshooting or management alongside commands like ping, tracert, ipconfig, netstat, nslookup, and others.

Читайте также:  Antix linux live usb
Оцените статью