在Exchange 2010中创建邮箱c#

时间:2015-07-13 11:22:14

标签: c# powershell-remoting

首先,我为我糟糕的英语道歉。

我想在Exchange 2010中创建邮箱用户。我总是说可以使用PowerShell完成搜索。 PowerShell Remoting还有另外一种方法吗?

1 个答案:

答案 0 :(得分:0)

我想我理解你的要求,如果我错了,请纠正我。

您想要远程连接到Exchange服务器然后创建邮箱吗?

使用以下内容连接到交换,非常简单,但您可以使用它做更多事情。

function Connect-MSExchSession
{
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true, Position = 0)]
        [string]$Server
    )

    $URI = 'http://' + $Server + '/powershell'
    $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $URI
    Import-Module (Import-PSSession $session -AllowClobber) -Global
}

连接后,应该只发布cmdlet New-Mailbox以及require属性,如果它是现有用户的新邮箱,那么它将是Enable-Mailbox