Windows Server 2016-批量新建域用户(二)
前几个章节我们讲到Windows Server 2016-图形化新建域用户(一),本章节我们简单讲解下如何通过命令批量创建域用户,以便高效完成日常工作中实际批量创建用户需求,内容涉及dsadd user、net user、new-aduser,具体信息如下: dsadd user创建用户: Dsadd是Windows Server 2008中内置的命令行工具。如果您安装了Active Directory域服务(AD DS)服务器角色,则可以使用它。要使用dsadd,必须从提升的命令提示符运行dsadd命令。若要打开提升的命令提示符,请单击“ 开始”,右键单击“ 命令提示符”,然后单击“以管理员身份运行”。 语法: dsadd?user?<UserDN>?[-samid?<SAMName>]?[-upn?<UPN>]?[-fn?<FirstName>]?[-mi?<Initial>]?[-ln?<LastName>]?[-display?<DisplayName>]?[-empid?<EmployeeID>]?[-pwd?{<Password>?|?*}]?[-desc?<Description>]?[-memberof?<Group>?...]?[-office?<Office>]?[-tel?<PhoneNumber>]?[-email?<Email>]?[-hometel?<HomePhoneNumber>]?[-pager?<PagerNumber>]?[-mobile?<CellPhoneNumber>]?[-fax?<FaxNumber>]?[-iptel?<IPPhoneNumber>]?[-webpg?<WebPage>]?[-title?<Title>]?[-dept?<Department>]?[-company?<Company>]?[-mgr?<Manager>]?[-hmdir?<HomeDirectory>]?[-hmdrv?<DriveLetter>:][-profile?<ProfilePath>]?[-loscr?<ScriptPath>]?[-mustchpwd?{yes?|?no}]?[-canchpwd?{yes?|?no}]?[-reversiblepwd?{yes?|?no}]?[-pwdneverexpires?{yes?|?no}]?[-acctexpires?<NumberOfDays>]?[-disabled?{yes?|?no}]?[{-s?<Server>?|?-d?<Domain>}]?[-u?<UserName>]?[-p?{<Password>?|?*}]?[-q]?[{-uc?|?-uco?|?-uci}] 注解: <userDN>:需要。指定要添加的用户的可分辨名称。如果省略专有名称,dsadd将从标准输入(stdin)中获取名称。 例1:在azureyun.local的syncall用户容器中创建名为cs002的已启用用户帐户 dsadd?user?CN=cs002,OU=Syncall,DC=local?-disabled?no 例2:创建名为cs003的启用用户帐户,密码为[email?protected],必须在首次登录时更改密码: dsadd?user?“CN=cs002,DC=local”?-disabled?no?–pwd?[email?protected]??-mustchpwd?yes 例3:创建cs004帐户,并设置密码永不过期,并使其成为同一OU中的AAA组的成员 dsadd?user?“CN=cs004,DC=local”?-disabled?no?–pwd?[email?protected]?-mustchpwd?yes?-memberof?CN=AAA,OU=Group,DC=local?-acctexpires?never net user批量创建域用户: for?/L?%a?in?(1,1,10)?do?net?user?TS%a?[email?protected]?/add?/domain 注解:(1,10)分别对应(开始值,递增量,终值),如果想递减(10,-1,1),TS%a 是用户名,[email?protected]是密码,密码必须符合复杂性要求。 Active Directory用户和计算机查看已创建用户: New ADUser创建域帐号 语法: New-ADUser [-WhatIf][-Confirm][-AccountExpirationDate <DateTime>][-AccountNotDelegated <Boolean>][-AccountPassword <SecureString>][-AllowReversiblePasswordEncryption <Boolean>][-AuthenticationPolicy <ADAuthenticationPolicy>][-AuthenticationPolicySilo <ADAuthenticationPolicySilo>][-AuthType <ADAuthType>][-CannotChangePassword <Boolean>][-Certificates <X509Certificate[]>][-ChangePasswordAtLogon <Boolean>][-City <String>][-Company <String>][-CompoundIdentitySupported <Boolean>][-Country <String>][-Credential <PSCredential>][-Department <String>][-Description <String>][-DisplayName <String>][-Division <String>][-EmailAddress <String>][-EmployeeID <String>][-EmployeeNumber <String>][-Enabled <Boolean>][-Fax <String>][-GivenName <String>][-HomeDirectory <String>][-HomeDrive <String>][-HomePage <String>][-HomePhone <String>][-Initials <String>][-Instance <ADUser>][-KerberosEncryptionType <ADKerberosEncryptionType>][-LogonWorkstations <String>][-Manager <ADUser>][-MobilePhone <String>][-Name] <String>[-Office <String>][-OfficePhone <String>][-Organization <String>][-OtherAttributes <Hashtable>][-OtherName <String>][-PassThru][-PasswordNeverExpires <Boolean>][-PasswordNotRequired <Boolean>][-Path <String>][-POBox <String>][-PostalCode <String>][-PrincipalsAllowedToDelegateToAccount <ADPrincipal[]>][-ProfilePath <String>][-SamAccountName <String>][-ScriptPath <String>][-Server <String>][-ServicePrincipalNames <String[]>][-SmartcardLogonRequired <Boolean>][-State <String>][-StreetAddress <String>][-Surname <String>][-Title <String>][-TrustedForDelegation <Boolean>][-Type <String>][-UserPrincipalName <String>][<CommonParameters>] 例1:创建cs001帐号: new-aduser –name cs001 -samaccountname cs001 –userprincipalname [email?protected] –givename 001 –surname cs –displayname CS001 –path "OU=Syncall,DC=local" 查看当前已有用户: get-aduser –filter * |select name
?Powershell批量创建测试域用户: $Password = "[email?protected]" $SecurePassword = $Password | ConvertTo-SecureString -AsPlainText -Force 1..10 |foreach-object {New-ADUser -Name "HP$_" -SamAccountName "HP$_" -UserPrincipalName HP$_@azureyun.local -path "OU=HelpDesk,DC=local" -AccountPassword $SecurePassword -Enabled $true -ChangePasswordAtLogon $false} 查看当前已创建域用户帐号: get-aduser –filter * |select name
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 更改整个控制台背景颜色(Win32 C)
- windows-server-2008 – RDP到Windows Server 2008终端服务
- winapi – 如何使用win32在D中创建Windows?
- windows – 以正常方式安装RDS与特殊RDS部署选项之间的区别
- windows – __deref_out_opt和__deref_opt_out之间有什么区
- Windows Server 2008 – 文件权限和管理员
- Vulkan Tutorial 01 开发环境搭建之Windows
- Microsoft SQL Server中的自然(人类字母数字)排序
- .net – 缺少WebClient标头属性添加方法?
- 无法将类型为“System.Linq.EnumerableQuery”的对象强制转
- windows-server-2008-r2 – Windows Server 2008
- windows-7 – Windows 7 VPN是否可与Cisco ASA 5
- 在Windows上运行更漂亮
- windows的bat脚本
- windows-server-2003 – 将Perfmon计数器名称放入
- wcf – 使用TcpClientCredentialType.Windows时的
- windows-8 – Win 8上的Windows Indentity Found
- windows – 使用音频电缆(或类似设备)从安全服务
- windows – 告诉Emacs在特定窗口中打开新缓冲区
- windows-server-2008 – 停止windows分页vmware