Well, i would do that, except that Exchange 2013 don't have System attendant service.
Also, we have 6 databases, how do i know which one to put in homeMDB field?
I did as you instructed anyway for test and still receive error:
<?xml version="1.0"?>
<Objects>
<Object Type="System.Management.Automation.PSCustomObject">
<Property Name="message" Type="System.String">Can't create user</Property>
<Property Name="detailMessage" Type="System.String">Cannot open mailbox /o=secureemail/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=SERVER/cn=Microsoft System Attendant. CategoryInfo:
NotSpecified: (:) [Set-MailboxRegionalConfiguration], StorageTransientException, FullyQualifiedErrorId: [Server=SERVER,RequestId=557e3eb8-ddbb-44c9aab1-d18c0682beb5,TimeStamp=3/19/2015 2:45:32 PM] [FailureCategory=Cmdlet-StorageTransientException] 2CC71ED6,Microsoft.Excha
nge.Management.StoreTasks.SetMailboxRegionalConfiguration</Property>
<Property Name="responseCode" Type="System.String">400</Property>
</Object>
</Objects>
Keep in mind that servers are in remote AD sites, replication and AD health is good!
This is script that is failing:
$ErrorActionPreference = "Stop";
try{
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
$OrganizationName = "ivica@eos.hr" #User defined mail address
$organizationUnit = "OU=$OrganizationName,OU=users,DC=domain,DC=priv";
$name = "John"
#this should be asked in web interface (firstname)
$lastname = "Dpe"
#this should be asked in web interface (lastname)
$displayName = "John Doe" # this is display name in OWA and in all address books
$logonName = "john" # this will be users choosen logon name (before @externaldomain.com)
$ExternalDomain = "example.com" #this value user will enter as his wanted username and will use it together with his external domain name -ivica@rolex.com
$UPN = "$LogonName@$ExternalDomain" #this should remain to be done automatically and under assumption domain is provisioned!!
$DomainController = "server" #this value must be specified based on domain controller in AD site where user will be created
$nonadmin = "$OrganizationName All Users"; #This is field for entire tenant management and members are used for calendar sharing
$database = "database"
$retentionPolicy = "DoNotRemove"
$customattribute1 = "$OrganizationName" #Add for possible manipulation of tenants for future need
$customattribute2 = "ServiceID"
$customattribute3 = "ContactID"
$customattribute4 = "ClientID"
$password =ConvertTo-SecureString 'Password123' -AsPlainText -Force
$mailbox = New-Mailbox -DomainController "$DomainController" -RetentionPolicy $retentionPolicy -UserPrincipalName $UPN -Name "$name $lastname" -OrganizationalUnit "$organizationUnit" -Password $password -FirstName "$name"
-LastName "$lastname" -Displayname "$Displayname" -database $database -ResetPasswordOnNextLogon $false #This is part where user is created
Start-Sleep -s 2;
Add-DistributionGroupMember -Identity "$nonadmin" -Member "$UPN" -BypassSecurityGroupManagerCheck -DomainController "$DomainController" #at this line user is placed in distribution group and
that group is used for additional security
Start-Sleep -s 2;
Set-Mailbox -AddressBookPolicy "$OrganizationName ABP" -Identity "$UPN" -DomainController "$DomainController" #from this point user gets his address book and isolation part.
Set-Mailbox -Identity "$UPN" -DomainController "$DomainController" -EmailAddressPolicyEnabled:$False #disables force of address policy
Set-Mailbox -identity "$UPN" -PrimarySmtpAddress $UPN -DomainController "$DomainController" ; #assigns default mail address
Start-Sleep -s 2;
Set-CASMailbox -identity "$UPN" -OwaMailboxPolicy Default -DomainController "$DomainController" #In this policy it is defined that user cant manage his password, as any future change will be managed globally here and automatically
applied to all users
Set-MailboxRegionalConfiguration -Identity "$UPN" -Language en-us -DomainController "$DomainController" -Confirm:$False
Set-MailboxFolderPermission -identity ${UPN}:\calendar -User default -accessrights none -DomainController "$DomainController"
add-MailboxFolderPermission -Identity ${UPN}:\calendar -user "$nonadmin" -AccessRights AvailabilityOnly -DomainController "$DomainController" #only members of classic users can see free/busy
set-mailbox -identity $UPN -customattribute1 $customattribute1 -customattribute2 $customattribute2 -customattribute3 $customattribute3 -customattribute4 $customattribute4 -DomainController "$DomainController"
$mailbox | Set-CasMailbox -DomainController "$DomainController" -ActiveSyncEnabled $true -PopEnabled $true -ImapEnabled $true -OWAEnabled $true -MAPIEnabled $true; #adding script for created user to be returned after creation
-
Edited by
IvekC
Thursday, March 19, 2015 2:52 PM