Create automatically Exchange Users from OU
Create automatically Exchange Users from OU.
$OU = "OU=Users,DC=example,DC=int"
$LdapFilter = "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))"
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "http://exchange.example.int/PowerShell/" -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session
$users = Get-ADUser -SearchBase $OU -LDAPFilter $LdapFilter
foreach($user in $users)
{
Enable-Mailbox -Identity $user.SamAccountName
}
Материал сайта pyatilistnik.org