Created
February 2, 2024 09:15
-
-
Save fluggelgleckheimlen/56abff246a0e705fd359b230159c412d to your computer and use it in GitHub Desktop.
Заполняет SimpleDisplayName при создании почтового ящика
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Configuration version="1.0"> | |
<Feature Name="NewMailbox" Cmdlets="New-Mailbox"> | |
<ApiCall Name="OnComplete"> | |
If ($succeeded) | |
{ | |
Start-Sleep -s 20 | |
$DC = [string]($readOnlyIConfigurable.originatingserver) | |
$User = Get-User -Identity $provisioningHandler.UserSpecifiedParameters["Alias"] | |
$Alias = Get-Mailbox -Identity $user.DistinguishedName | |
If (($Alias.IsShared -eq $False) -and ($Alias.IsLinked -eq $False) -and ($Alias.IsResource -eq $False) -and ($Alias.IsRootPublicFolderMailbox -eq $False)) | |
{ | |
$SDN = "$($User.FirstName) $($User.LastName)"; | |
$SDN = $SDN.Trim(); | |
If ($SDN -match '[A-Z]+') { | |
Set-User $User -simpleDisplayName $SDN | |
} | |
} | |
} | |
</ApiCall> | |
</Feature> | |
<Feature Name="EnableMailbox" Cmdlets="Enable-Mailbox"> | |
<ApiCall Name="OnComplete"> | |
If ($succeeded) | |
{ | |
Start-Sleep -s 20 | |
$DC = [string]($readOnlyIConfigurable.originatingserver) | |
$User = Get-User -Identity $provisioningHandler.UserSpecifiedParameters["Alias"] | |
$Alias = Get-Mailbox -Identity $user.DistinguishedName | |
If (($Alias.IsShared -eq $False) -and ($Alias.IsLinked -eq $False) -and ($Alias.IsResource -eq $False) -and ($Alias.IsRootPublicFolderMailbox -eq $False)) | |
{ | |
$SDN = "$($User.FirstName) $($User.LastName)" | |
$SDN = $SDN.Trim() | |
If ($SDN -match '[A-Z]+') { | |
Set-User $User -simpleDisplayName $SDN | |
} | |
} | |
} | |
</ApiCall> | |
</Feature> | |
</Configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment