将如何使用PowerShell的一个CSV文件中添加一组用户到Active Directory?
How would one add a group of users to Active Directory from a csv file using PowerShell?
CSV文件将包含的第一个,最后一个,电子邮件,临时密码,并描述了用户使用。该OU,权限等可能很难codeD。
The csv file would contain the first, last, email, temp password, and description for the users. The OU, permissions, and etc. could be hard coded.
这个脚本应该还添加Exchange 2007邮箱。
The script should also add an Exchange 2007 email box.
CSV文件应包含一个标题行的所有字段名。
The csv file should contain a header row with all the field names.
下面是code:
$Users = Import-Csv ".\UsersFile.csv"
foreach ($User in $Users)
{
New-Mailbox -Name $User.Name -Alias $User.MailboxAlias `
-OrganizationalUnit $User.OU `
-UserPrincipalName $User.UPN -SamAccountName $User.UserName `
-FirstName $User.First -Initials $USer.Initial -LastName $User.Last `
-Password $User.Password -ResetPasswordOnNextLogon $false `
-Database 'MailboxDatabaseFilename'
}
上一篇:算法解决的均匀分布/偶空白点螺旋?空白点、螺旋、算法、均匀
下一篇:如何单元测试对Active Directory中的NextPasswordChangeDate功能单元测试、功能、Directory、Active