20210208 | 您所在的位置:网站首页 › cmd更改用户名命令 › 20210208 |
1. WMIC设置用户过期: WMIC.EXE Path Win32_UserAccount Where Name="Administrator" Set PasswordExpires="TRUE" NET User 命令参数参考 username -- specifies the username you want to run the operation on. 指定需要操作的用户名, 如后面不加参数, 则显示此用户的详细信息: password -- sets the password for the specified username. Must satisfy the minimum length requirement, and may have as many as 127 characters.* -- displays a prompt for the password. Password is not shown when entered. 修改某用户的密码 /domain -- performs the operation on the selected domain. /? or /help -- displays the help text for the Net User command. 显示帮助命令/active:yes|no -- this commands activates (yes), or deactivates (no) the specified user account. 激活某个用户, 在Windows 10中, 默认本地管理员administrator为禁用状态. 此命令常用来激活此用户 /add -- will add the selected user account to the computer system. 创建新用户 /delete -- removes the selected user account from the system. 删除某个用户. 通常删除用户之后, 还需要删除C:\Users\下用户的个人目录.
/command:"text" -- adds a comment to the selected user account. Limited to 48 characters. Visible in the description field of the user account. 为用户添加描述信息./countrycode:0 -- Adds country code or region information to the account. A value of 0, or not using the parameter, sets it to the default region./expires:date|never -- Sets the user account to expire at the specified date, or never expire. Expiration dates are set using mm/dd/yy, e.g. 12/24/2019, or Mar/13/19. 设定账户过期时间/fullname:"name" -- Sets the full name for the selected account. Must be enclosed in quotation marks. 修改用户的显示名称. 例如将管理员用户显示名修改为LocalUser /homedir=path -- Sets the users home directory to the selected path. Please note that the path needs to exist, so create it in advance before you run the command./passwordchg:yes|no -- Specifies whether the user may change the password. The default value is yes which means that password changing is allowed. /passwordreq:yes|no -- Specifies whether the user account needs to have a password. The default is yes, which means that a password is required./logonpasswordchg:yes|no -- When set to yes, prompts the user to change the account password on the next logon to the system. 在下次登录时, 需要修改密码. 常用在无人值守应答文件中. 使得指定用户在首次登入时, 修改密码. 注: 在应答文件中使用Microsoft-Windows-Deployment中RunSynchronous 添加此命令. 需先保证用户已经创建且激活(/Active:Yes). 在系统封装前, 建议在计算机管理内先设置勾选此用户"在下次登陆时修改密码", 并封装. 如在应答文件中使用此设定, 不建议添加Microsoft-Windows-Setup-Shell中的UserAccounts中的AdministratorPassword. /profilepath:path -- Sets the path for the user's logon profile. The path points to a Registry profile./scriptpath:path -- Sets the path for the user's logon script. Path needs to be relative to %systemroot%\System32\Repl\Import\Scripts/times:times|all -- Sets the logon hours for the account. Times needs to be specified as Day,Hour-Hour and separated by semicolon, e.g. M,2PM-8PM;T, 1PM-9PM. Days of the week abbreviated as M, T, W, Th, F, Sa, Su, may combine days, e.g. Monday-Friday. All means a user is not restricted when it comes to logins, no value means logons are not allowed./usercomment:"text" -- May set a user comment for the account./workstations:computerName -- Specify up to eight computers the user may log on to. Separate names by ,. e.g computer1, computer2, computerx. Works best with /domain, and if you don't specify this value, user is not restricted when it comes to workstations. 附: 未启用bitlocker的系统, 如忘记密码,如何修改: 免责声明: 此方法仅供学习交流, 读者任何操作产生的损益与作者无关. Windows系统中, 一些系统工具以.exe文件形式存放在C:\Windows\System32\下. 其中在用户未登录情况下, 登陆界面能打开的程序为"软键盘"程序. 即: C:\Windows\System32\osk.exe 从上述介绍可知,可使用net user username password 来修改密码. 操作步骤: 准备一个U盘, 制作一个PE启动盘(微软官网PE/ 大白菜/ 老毛桃/ 微PE等等) 机器从PE盘启动, 执行以下命令. 将C:\Windows\System32\的osk.exe备份, 将cmd.exe复制为osk.exe cd /d C:\Windows\System32 copy osk.exe osk-bk.exe copy cmd.exe osk.exe重启机器到登入界面. 点击右下角的"轻松使用", 选择"屏幕软键盘" 此时打开的应该是命令行提示符. 使用修改密码命令, 修改用户密码 net user administrator test1234 之后即可进入系统. 注意osk.exe和cmd.exe只能在离线(Offline)环境下修改. 例如启动到WinPE后,修改硬盘内容.
注:此方法在Windows 10 Pro/Home验证通过. Windows 10 IoT此方法不可行.
|
CopyRight 2018-2019 实验室设备网 版权所有 |