具有净用户的Windows用户管理,例如创建,删除,设置密码

Windows operating system have a lot of command line and GUI tools to manage user accounts. The most popular user management tool from command line like ms-dos or powershell is net user command. In this tutorial we will look different usage examples about net user command.

Windows操作系统具有许多用于管理用户帐户的命令行和GUI工具。 诸如ms-dos或powershell等命令行中最流行的用户管理工具是net user命令。 在本教程中,我们将查找有关net user命令的不同用法示例。

帮帮我 (Help)

Help about the net user command can be get with the /? option like below.

可以使用/?获得有关net user命令的帮助/? 如下所示的选项。

$ net user /?
net user Help
net user Help
网络用户帮助

区分大小写(Case Sensitivity)

Before starting issuing commands we need to know that Windows is generally incase sensitive system. So following commands can be used uppercase or lowercase with username. The only exception is the password. So following commands are the same. But using accepted usage which is uppercase will make commands more readable

在开始发出命令之前,我们需要知道Windows通常是区分大小写的系统。 因此,以下命令可以与用户名一起使用大写或小写。 唯一的例外是密码。 因此,以下命令相同。 但是使用大写的可接受用法将使命令更具可读性

net user
NeT UsEr

列出用户 (List  Users)

Existing user accounts can be listed just issuing the net user command without any option. Only local user accounts will be listed. Domain user accounts will not be listed.

只需发出net user命令即可列出现有的用户帐户,而无需任何选择。 仅列出本地用户帐户。 域用户帐户将不会列出。

$ net user
List Users
List Users
列出用户

As we can the the default users like Administrator and Guest all ready exist.  New user ismail is added previously.

尽我们所能,默认用户(例如Administrator和Guest)已经准备就绪。 先前已添加新用户ismail

获取用户帐户信息 (Get User Account Information)

The user information can be get by providing the user account name.

用户信息可以通过提供用户帐户名获得。

$ net user jack
Get User Account Information
Get User Account Information
获取用户帐户信息

This will list following information;

这将列出以下信息;

  • User name

    用户名
  • Full name

    全名
  • Comment

    评论
  • User’s comments

    用户评论
  • Country Code

    国家代码
  • Account Active

    帐户有效
  • Account Expires line shows where her after specified time account will be locked

    Account Expires行显示她在指定时间后将被锁定的位置

  • Password Last Set line shows when the password is set for the last time

    Password Last Set行显示Password Last Set密码的时间

  • Password Expires line shows whether the password of the user will expire after specified time.

    Password Expires行显示用户的密码在指定时间后是否将过期。

  • Password Changeable

    Password Changeable

  • Password Required line shows whether user account login needs password.

    Password Required行显示用户帐户登录是否需要密码。

  • User may change password line show whether the user have privileges to change his own password.

    User may change password行,显示用户是否有权更改自己的密码。

  • Workstations allowed line show in which computers the user can login.

    Workstations allowed行显示用户可以登录的计算机。

  • Logon script line shows which script file will be run during user logon

    Logon script行显示在用户登录期间将运行哪个脚本文件

  • User profile

    User profile

  • Home directory line shows if the user home path is different then default location what is the user home path.

    Home directory行显示用户Home directory路径是否不同,然后默认位置是用户主目录路径。

  • Last logon line shows what is the time where the user last time login.

    Last logon行显示用户上次登录的时间。

  • Logon hours allowed line shows which hours is the user allowed to login.

    Logon hours allowed行显示Logon hours allowed用户登录的时间。

  • Local Group Memberships line show the local groups where the user is a member

    Local Group Memberships行显示用户所在的本地组

  • Global group memberships line show the global groups where the user is a member

    Global group memberships行显示用户所属的全局组

LEARN MORE  User Groups in Linux
在Linux中了解更多用户组

创建用户帐号(Create  User Account)

Users can be created with net user . This user will be created locally and do not exists in Active Directory. We will provide the user name to the command and /ADD option like below. In this example we create a user named test .

可以使用net user创建net user 。 该用户将在本地创建,并且在Active Directory中不存在。 我们将提供用户名给命令和/ADD选项,如下所示。 在此示例中,我们创建一个名为test的用户。

$ net user test /ADD
Create User Account
Create User Account
创建用户帐号

The user is created successfully. If there is a problem we will get an error like

用户创建成功。 如果有问题,我们会收到类似的错误

  • The account all ready exists

    The account all ready exists

  • System error 5 has occurred. Access is denied is we have do not have required privileges like Administrator.

    System error 5 has occurred. Access is denied System error 5 has occurred. Access is denied因为我们没有管理员那样的必需特权。

删除用户帐号 (Remove  User Account)

A user can be easily removed with the /DELETE option.

使用/DELETE选项可以轻松删除用户。

$ net user test /DELETE
Remove User Account
Remove User Account
删除用户帐号

创建用户帐户时设置密码(Set Password While User Account Creation)

While creating user account we can set the password. But changing user creation time password will make things more secure. We will just append the user account password after user account name. In this example we will create a user account named test and set password 123456

创建用户帐户时,我们可以设置密码。 但是更改用户创建时间密码将使事情更加安全。 我们将仅在用户帐户名称后附加用户帐户密码。 在此示例中,我们将创建一个名为test的用户帐户并设置密码123456。

$ net user test 123456 /ADD
Set Password While User Account Creation
Set Password While User Account Creation
创建用户帐户时设置密码

设置密码现有用户(Set Password Existing User)

Changing existing user password is very similar to while adding. We will just remove the /ADD and only provide the user account name and new password. In this example we set user test password as 654321

更改现有用户密码与添加时非常相似。 我们将只删除/ADD ,仅提供用户帐户名和新密码。 在此示例中,我们将用户test密码设置为654321

$ net user test 123456
Set Password Existing User
Set Password Existing User
设置密码现有用户

在域用户上操作(Operate On Domain Users)

Up to now we have operated on local users. Windows Active directory very popular technology used by corporates. Previously described commands can be used to manipulate domain users too. We just need to add /DOMAIN option to the command. We need Domain Admin privileges to run these commands. Also current worked computer should be joined related domain.

到目前为止,我们已经对本地用户进行了操作。 Windows Active Directory是企业使用的非常流行的技术。 先前描述的命令也可以用于操纵域用户。 我们只需要在命令中添加/DOMAIN选项即可。 我们需要Domain Admin特权才能运行这些命令。 当前工作的计算机也应加入相关领域。

LEARN MORE  How to Find Detailed Domain Information with whois Command?
了解更多信息如何使用whois命令查找详细的域信息?

将用户帐户添加到域 (Add User Account To Domain)

$ net user test /ADD /DOMAIN

删除删除用户帐户 (Delete Remove User Account)

$ net user test /DELETE /DOMAIN

修改用户帐号密码 (Change User Account Password)

$ net user test 123456 /DOMAIN

锁定或禁用用户帐户 (Lock or Disable User Account)

Windows operating system provides the ability to lock or disable user accounts. Locking accounts generally used for security. Locking or disabling account will prevent the account to login to the Windows systems. User account can be locked or disabled with /active:no option.

Windows操作系统提供了锁定或禁用用户帐户的功能。 锁定帐户通常用于安全性。 锁定或禁用帐户将阻止该帐户登录Windows系统。 可以使用/active:no选项锁定或禁用用户帐户。

In this example we will lock user account named jack .

在此示例中,我们将锁定名为jack用户帐户。

$ net user jack /active:no

启用用户帐号 (Enable User Account)

The reverse operation can be done to enable all ready locked or disabled account. In this example we will unlock the user account jack .

可以执行相反的操作来启用所有准备好的锁定或禁用帐户。 在此示例中,我们将解锁用户帐户jack

$ net user jack /active:yes
 

翻译自: https://www.poftut.com/windows-user-management-net-user-like-creating-deleting-setting-password/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值