windows下忘记用户密码或者管理员被禁用,适用以下方法:

1.net user 添加用户

NET USER
[username [password | *] [options]] [/DOMAIN]
         username {password | *} /ADD [options] [/DOMAIN]
         username [/DELETE] [/DOMAIN]

NET USER creates and modifies user accounts on computers. When used
without switches, it lists the user accounts for the computer. The
user account information is stored in the user accounts database.

This command works only on servers.


username     Is the name of the user account to add, delete, modify, or
             view. The name of the user account can have as many as
             20 characters.
password     Assigns or changes a password for the user's account.
             A password must satisfy the minimum length set with the
             /MINPWLEN option of the NET ACCOUNTS command. It can have as
             many as 14 characters.
*            Produces a prompt for the password. The password is not
             displayed when you type it at a password prompt.
/DOMAIN      Performs the operation on a domain controller of
             the current domain.
/ADD         Adds a user account to the user accounts database.
/DELETE      Removes a user account from the user accounts database.

Options      Are as follows:

   Options                    Description
   --------------------------------------------------------------------
   /ACTIVE:{YES | NO}         Activates or deactivates the account. If
                              the account is not active, the user cannot
                              access the server. The default is YES.
   /COMMENT:"text"            Provides a descriptive comment about the
                              user's account (maximum of 48 characters).
                              Enclose the text in quotation marks.
   /COUNTRYCODE:nnn           Uses the operating system country code to
                              implement the specified language files for a
                              user's help and error messages. A value of
                              0 signifies the default country code.
   /EXPIRES:{date | NEVER}    Causes the account to expire if date is
                              set. NEVER sets no time limit on the
                              account. An expiration date is in the
                              form mm/dd/yy or dd/mm/yy, depending on the
                              country code. Months can be a number,
                              spelled out, or abbreviated with three
                              letters. Year can be two or four numbers.
                              Use slashes(/) (no spaces) to separate
                              parts of the date.
   /FULLNAME:"name"           Is a user's full name (rather than a
                              username). Enclose the name in quotation
                              marks.
   /HOMEDIR:pathname          Sets the path for the user's home directory.
                              The path must exist.
   /PASSWORDCHG:{YES | NO}    Specifies whether users can change their
                              own password. The default is YES.
   /PASSWORDREQ:{YES | NO}    Specifies whether a user account must have
                              a password. The default is YES.
   /PROFILEPATH[:path]        Sets a path for the user's logon profile.
   /SCRIPTPATH:pathname       Is the location of the user's logon
                              script.
   /TIMES:{times | ALL}       Is the logon hours. TIMES is expressed as
                              day[-day][,day[-day]],time[-time][,time
                              [-time]], limited to 1-hour increments.
                              Days can be spelled out or abbreviated.
                              Hours can be 12- or 24-hour notation. For
                              12-hour notation, use am, pm, a.m., or
                              p.m. ALL means a user can always log on,
                              and a blank value means a user can never
                              log on. Separate day and time entries with
                              a comma, and separate multiple day and time
                              entries with a semicolon.
   /USERCOMMENT:"text"        Lets an administrator add or change the User
                              Comment for the account.
   /WORKSTATIONS:{computername[,...] | *}
                              Lists as many as eight computers from
                              which a user can log on to the network. If
                              /WORKSTATIONS has no list or if the list is *,
                              the user can log on from any computer.

举例: net user jhon 123 /add

2.net localgroup 提权

NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
              groupname {/ADD [/COMMENT:"text"] | /DELETE}  [/DOMAIN]
              groupname name [...] {/ADD | /DELETE} [/DOMAIN]

NET LOCALGROUP modifies local groups on computers. When used without
options, it displays the local groups on the computer.

groupname        Is the name of the local group to add, expand, or
                 delete. Supply only a groupname to view a list of
                 users or global groups in a local group.
/COMMENT:"text"  Adds a comment for a new or existing group.
                 Enclose the text in quotation marks.
/DOMAIN          Performs the operation on the domain controller
                 of the current domain. Otherwise, the operation is
                 performed on the local workstation.
name [ ...]      Lists one or more usernames or groupnames to add or to
                 remove from a local group. Separate multiple entries with
                 a space. Names may be users or global groups, but not
                 other local groups. If a user is from another domain,
                 preface the username with the domain name (for
                 example, SALES\RALPHR).
/ADD             Adds a groupname or username to a local group. An account
                 must be established for users or global groups added to a
                 local group with this command.
/DELETE          Removes a groupname or username from a local group.

举例:net localgroup administrators jhon /add

另外方法: 在PE下,可以添加系统管理员用户。

批处理建立用户 – Net User命令用法

建立windows系统用户的方法比较简单,也没多少可谈的。但是当你需要建立一票用户,然后设置密码、更改用户组,这本来简单的东西却变的很麻烦。这里介绍net user 命令来建立成票的用户,或者说批量建立用户吧。

下面给出建立一个名为ctusky1,密码为ctusky的用户,并只将他放入Guests用户组的批处理代码:

::ctusky1 改为你需要建立的用户名,ctusky改为你的密码,后面的两个参数的意思是“用户不可以更改密码”和“密码永不过期”
net user ctusky1 ctusky /add /passwordchg:no /expires:never
::将ctusky1 放入Gusets组中
net localgroup Guests ctusky1 /add
::将ctusky1 从Users组中去除
net localgroup Users ctusky1 /del

同理,如果你需要建立一批预先设计好的用户名和密码包括用户组的用户,那你只能使用复制粘贴大法了。但是如果你需要建立一些有规律的用户,那么你可以这样做:

::本例为建立30个类似ctusky01、ctusky02这样的Guests组用户,密码为123456且用户不可更改密码和密码永不过期。
@echo off
for /l %%a in (1,1,30) do (
if %%a lss 10 (
net user ctusky0%%a 123456 /add /passwordchg:no /expires:never
net localgroup Guests ctusky0%%a /add
net localgroup Users ctusky0%%a /del
) else (
net user ctusky%%a 123456 /add /passwordchg:no /expires:never
net localgroup Guests ctusky%%a /add
net localgroup Users ctusky%%a /del
)
)

下面再给出Net User命令的语法、参数:
语法

net user [UserName [Password | *] [Options]] [/domain]
net user [UserName {Password | *} /add [Options] [/domain]]
net user [UserName [/delete] [/domain]]

参数
UserName
指定要添加、删除、修改或查看的用户帐户名称。用户帐户名可以含有 20 个字符。
Password
为用户帐户指派或更改密码。键入星号 (*) 将给出密码的提示。在密码提示符下处键入密码时不显示密码。
/domain
在计算机主域的域控制器上执行操作。
Options
指定命令行选项。下表列出可以使用的有效命令行选项。
命令行选项语法描述

/active:{no | yes_ 启用或禁用用户帐户。如果用户帐户未处于活动状态,则用户将不能访问计算机上的资源。默认设置为 yes(即处于活动状态)。
/comment:”Text” 提供关于用户帐户的描述性注释。该注释可以包含多达 48 个字符。给文本加上引号。
/countrycode:NNN 使用操作系统“国家(地区)”代码为用户帮助及错误消息执行指定的语言文件。值 0 表示默认的“国家(地区)”代码。
/expires:{{MM/DD/YYYY | DD/MM/YYYY | mmm,dd ,YYYY} | never} 如果指定 date 将导致用户帐户过期。过期时间根据“国家(地区)”代码的不同,可以有三种格式:[MM/DD/YYYY]、[DD/MM/YYYY] 或 [mmm,dd ,YYYY]。请注意,帐户将在指定日期开始时过期。对于表示月份的值,可以使用数字、将其拼出或者使用三个字母的缩写(即 Jan、Feb、Mar、Apr、May、Jun、Jul、Aug、Sep、Oct、Nov 及 Dec)来表示。可以使用两个或四个数字表示年的值。使用逗号或斜杠分隔日期的各部分。请不要使用空格。如果省略了 YYYY,则将假定下一个出现的日期(即根据该计算机的日期和时间)为所需日期。例如,如果在 1994 年 1 月 10 日和 1995 年 1 月 8 日之间输入,以下项将相等:
jan,9
1/9/95
january,9,1995
1/9
/fullname:”Name” 指定用户的全名而不是用户名。给该名称加上引号。
/homedir:Path 为用户的主目录设置路径。该目录必须存在。
/passwordchg:{yes | no} 指定用户是否可以更改其密码。默认设置为 yes。
/passwordreq:{yes | no} 指定用户帐户是否必须具有密码。默认设置为 yes。
/profilepath:[Path] 为用户登录配置文件设置路径。该路径将指向某个注册表配置文件。
/scriptpath:Path 为用户登录脚本设置路径。Path 不能是绝对路径。Path 是相对于 %systemroot%\System32\Repl\Import\Scripts 的路径。
/times:{Day[-Day][,Day[-Day]],Time[-Time][,Time[-Time]][;] | all} 指定允许用户使用该计算机的次数。Time 被限定为一小时的增量。对于 Day 的值,可以将其拼出或使用缩写(即 M、T、W、Th、F、Sa 和 Su)。可以使用 12 小时制或 24 小时制表示法表示小时。对于 12 小时制表示法,请使用 AM 和 PM 或 A.M. 和 P.M.。值 all 表示用户始终可以登录。空值(空白)表示用户永远不能登录。用逗号分隔日期和时间,用分号分隔日期和时间单元(如 M,4AM-5PM;T,1PM-3PM)。指定时间时不要使用空格。
/usercomment:”Text” 指定管理员可以添加或更改帐户的“用户注释”。给文本加上引号。
/workstations:{ComputerName[,...] | *} 最多列出 8 个用户可以登录到网络的工作站。用逗号分隔列表中的多个项。如果 /workstations 没有列表,或者如果列表是星号 (*),则用户可从任何计算机上登录。

示例

要显示本地计算机上所有用户帐户的列表,请键入:
net user
要查看有关用户帐户 jimmyh 的信息,请键入:
net user jimmyh
要添加用户帐户 Jay Jamison,登录权限从星期一到星期五的上午 8 点到下午 5 点(时间指定中没有空格),使用强制密码 (jayj) 和用户全名,请键入:
net user jayj /add /passwordreq:yes /times:monday-friday,8am-5pm/fullname:”Jay Jamison”
要使用 24 小时制表示法设置 johnsw 的登录时间(上午 8 点到下午 5 点),请键入:
net user johnsw /time:M-F,08:00-17:00
要使用 12 小时制表示法设置 johnsw 的登录时间(上午 8 点到下午 5 点),请键入:
net user johnsw /time:M-F,8am-5pm
要指定 marysl 的登录时间为星期一的早晨 4 点到下午 5 点、星期二的下午 1 点到 3 点以及星期三到星期五的上午 8 点到下午 5 点,请键入:
net user marysl /time:M,4am-5pm;T,1pm-3pm;W-F,8:00-17:00

net user 查看系统中的用户信息
net user user /add 添加用户user
net localgroup Administrators user /add 添加user用户为管理员组
net localgroup users user /del 从users组中删除user用户
net user user 查看user用户用户信息
net user user /active:no 禁用user用户
net user user /active:yes 激活user用户
net user user 123456 改变user用户密码为123456,不需要知道原密码
net user user “” 改变user用户密码为空
net user user /passwordchg:yes 用户user可以改变密码
net user user /passwordreq:yes 用户user必须拥有密码
net user user /expires:never 用户user密码永不过期
net user user /del 删除user用户