【问题标题】:Automation of mailbox and Active Directory account creation邮箱和 Active Directory 帐户创建自动化
【发布时间】:2017-10-11 20:11:10
【问题描述】:

我们正在考虑尝试在新人加入我们的组织并进入我们的人事系统(用 VB.Net 编写)时自动创建 Exchange 2016 邮箱和关联的 Active Directory 2012 R2 帐户。目前他们加入并进入系统,然后其他人必须创建邮箱和 AD 帐户,这通常有一个提前期,导致用户在一段时间内无法访问或访问受限。我们希望通过自动化流程来消除这个问题并减轻负担。

我们原本希望能够通过 Exchange Web 服务调用来做到这一点,但不幸的是,这似乎是不可能的。我们现在考虑的是在将用户添加到我们的人事系统时自动创建一个 powershell 脚本,然后该脚本将运行以创建邮箱和活动目录帐户。这是最好的方法吗?我们没有这样做的经验,并希望确保我们走的是最明智的路线。

感谢任何想法和反馈。

【问题讨论】:

  • 我在这里使用 powershell。设置计划任务以根据需要经常在后台运行 powershell 脚本。
  • 我们遇到了类似的问题,您能告诉我为什么 Exchange Web 服务调用不起作用吗?

标签: vb.net powershell active-directory exchangewebservices exchange-server-2016


【解决方案1】:

Powershell 是最好的方法。您可以运行计划任务,该任务对您的 ERP 进行数据库调用以查找任何新用户,或者您可以导出属性的 csv 以用于创建帐户。

这是代码的基本框架:

    $Data = Import-CSV "c:\path\to\datafile.csv"

    foreach ($user in $data) {
        $TargetOU = "OU=CompanySite,DC=example,DC=domain,DC=com"  #Use this for where to create the Accounts

        #Note: You need to either generate a random password or supply one via the import.  I recommend random generation and then have the user set one when the arrive.
        New-ADUser -SamAccountName $user.username -GivenName $user.FirstName -Surname $user.LastName -AccountPassword $password -Path $TargetOU -etc -etc -etc #You can set as many attributes as you'd like at creation

        Sleep 10 #allow for propogation of account to all DCs

        Enable-Mailbox -Identity $user.username -Alias $user.username -Database "only needed if you specify a database manually"
        Set-Mailbox -etc -etc #use for anything that needs to be configured after the mailbox is enabled.
        }

【讨论】:

  • 感谢您抽出宝贵时间回复。这是我们要走的路线,所以我把它标记为答案。
  • Powershell 方法的问题是我们的整个用户管理都集中在一个应用程序中,现在 Exchange 邮箱的创建是在一个完全独立的过程中完成的。集中式应用程序不知道此邮箱创建是否成功,而且无法即时确定用户的 Exchange 设置。
猜你喜欢
  • 2014-06-15
  • 1970-01-01
  • 2020-07-28
  • 1970-01-01
  • 1970-01-01
  • 2012-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多