天天看點

PowerShell在Exchange2010下互動式建立域使用者和郵箱

這次需求也很簡單,但是問題是你架不住要操作的郵箱那麼多啊。。。

依然PowerShell搞定,需要Exchange的相應子產品

1

2

3

4

5

<code>write-output</code> <code>"本指令用來快速建立非使用者的域帳戶和郵箱,預設儲存在tech.xxx.com/非使用者賬戶/mailbox下,密碼xxxxxx"</code> 

<code>$a</code> <code>= </code><code>Read-Host</code><code>(</code><code>"請輸入非使用者郵箱的英文部分,這個部分也是使用者的登陸名,例如   feiyonghu"</code><code>)</code>

<code>$b</code> <code>= </code><code>Read-Host</code><code>(</code><code>"請輸入非使用者郵箱的中文部分,也就是顯示名稱,例如    非使用者"</code><code>)</code>

<code>$pass</code> <code>= </code><code>ConvertTo-SecureString</code> <code>-AsPlainText 12333333.abc -Force</code>

<code>New-Mailbox</code> <code>-Name </code><code>$b</code> <code>-</code><code>Alias</code> <code>$a</code> <code>-OrganizationalUnit </code><code>'tech.xxx.com/非使用者賬戶/mailbox'</code> <code>-UserPrincipalName </code><code>$a</code><code>@bbb</code><code>.contoso.com -SamAccountName </code><code>$a</code> <code>-FirstName </code><code>''</code> <code>-Initials </code><code>''</code> <code>-LastName </code><code>''</code> <code>-password </code><code>$pass</code> <code>-ResetPasswordOnNextLogon </code><code>$false</code>

互動式的,操作起來賞心悅目,更關鍵的是速度快。自動建立域賬戶,給定密碼1233333.abc,當然這裡你也可以自己修改。

賬戶被放置在下面這個OU下

tech.xxx.com/非使用者賬戶/mailbox

本文轉自 九叔 51CTO部落格,原文連結:http://blog.51cto.com/jiushu/1649625,如需轉載請自行聯系原作者

繼續閱讀