欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Windows Server 2016-Powershell新建用户补充

程序员文章站 2022-04-23 09:10:39
前边我们介绍到Windows Server 2016-图形化新建域用户(一) 及 Windows Server 2016-批量新建域用户(二) ,里边提到了批量通过new-aduser常见帐号,这里简单的对前章节内容做个补充,具体信息如下: 命令语法: 常用字段注解: 例:创建wen帐号: ......

前边我们介绍到windows server 2016-图形化新建域用户(一)windows server 2016-批量新建域用户(二) ,里边提到了批量通过new-aduser常见帐号,这里简单的对前章节内容做个补充,具体信息如下:

命令语法:

new-aduser [-name] <string> [-accountexpirationdate <system.nullable[system.datetime]>] [-accountnotdelegated <system.nullable[bool]>] [-accountpassword <securestring>] [-allowreversiblepasswordencryption <system.nullable[bool]>] [-authtype {<negotiate> | <basic>}] [-cannotchangepassword <system.nullable[bool]>] [-certificates <x509certificate[]>] [-changepasswordatlogon <system.nullable[bool]>] [-city <string>] [-company <string>] [-country <string>] [-credential <pscredential>] [-department <string>] [-description <string>] [-displayname <string>] [-division <string>] [-emailaddress <string>] [-employeeid <string>] [-employeenumber <string>] [-enabled <system.nullable[bool]>] [-fax <string>] [-givenname <string>] [-homedirectory <string>] [-homedrive <string>] [-homepage <string>] [-homephone <string>] [-initials <string>] [-instance <aduser>] [-logonworkstations <string>] [-manager <aduser>] [-mobilephone <string>] [-office <string>] [-officephone <string>] [-organization <string>] [-otherattributes <hashtable>] [-othername <string>] [-passthru <switch>] [-passwordneverexpires <system.nullable[bool]>] [-passwordnotrequired <system.nullable[bool]>] [-path <string>] [-pobox <string>] [-postalcode <string>] [-profilepath <string>] [-samaccountname <string>] [-scriptpath <string>] [-server <string>] [-serviceprincipalnames <string[]>] [-smartcardlogonrequired <system.nullable[bool]>] [-state <string>] [-streetaddress <string>] [-surname <string>] [-title <string>] [-trustedfordelegation <system.nullable[bool]>] [-type <string>] [-userprincipalname <string>] [-confirm] [-whatif] [<commonparameters>]

 

常用字段注解:

name 姓名
accountexpirationdate 账户到期时间
city 城市
company 公司
department 部门
description 描述
displayname 显示名称
emailaddress 电子邮件地址
employeeid 员工id
employeenumber 员工编号
homephone 家庭电话
manager 经理
mobilephone 移动电话
office 办公室
officephone 办公室电话
organization 组织
passwordneverexpires 密码永不过期
samaccountname 用户登录名(老版本/不带@)
streetaddress 街道地址
title 职称
userprincipalname upn用户登录名带@符

例:创建wen帐号:

new-aduser -name wen -samaccountname wen -userprincipalname wen@a.com -accountpassword (convertto-securestring "p@ssw0rd" -asplaintext -force) -enabled $true -changepasswordatlogon $false