테스트용: 루프 돌면서 메일박스 생성하는 예제


$DOMAIN='pnplab.net'


for ($i = 1; $i -lt 16; $i++) {

$NAME='mstest'+$i.ToString("00")

New-Mailbox -DisplayName "$NAME" -Name "$NAME" -Alias "$NAME" -UserPrincipalName "${NAME}@${DOMAIN}" -SamAccountName "$NAME" `

-Password (ConvertTo-SecureString -AsPlainText "password1!" -Force) `

-ResetPasswordOnNextLogon $false

}


New-Mailbox -UserPrincipalName "C60_CONF1@${DOMAIN}" -Alias C60_CONF1 -Name C60_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "C60_CONF2@${DOMAIN}" -Alias C60_CONF2 -Name C60_CONF2 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "C60_A10_CONF1@${DOMAIN}" -Alias C60_A10_CONF1 -Name C60_A10_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "C60_A20_CONF1@${DOMAIN}" -Alias C60_A20_CONF1 -Name C60_A20_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "US_C60_CONF1@${DOMAIN}" -Alias US_C60_CONF1 -Name US_C60_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "EU_C60_CONF1@${DOMAIN}" -Alias EU_C60_CONF1 -Name EU_C60_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "C01_CONF1@${DOMAIN}" -Alias C01_CONF1 -Name C01_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "C01_A01_CONF1@${DOMAIN}" -Alias C01_A01_CONF1 -Name C01_A01_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "US_C01_CONF1@${DOMAIN}" -Alias US_C01_CONF1 -Name US_C01_CONF1 -Room -ResetPasswordOnNextLogon $true

New-Mailbox -UserPrincipalName "EU_C01_CONF1@${DOMAIN}" -Alias EU_C01_CONF1 -Name EU_C01_CONF1 -Room -ResetPasswordOnNextLogon $true


New-DistributionGroup -Name C60_Org1 -Type Distribution

New-DistributionGroup -Name C60_Org2 -Type Distribution

New-DistributionGroup -Name C60_A10 -Type Distribution

New-DistributionGroup -Name C60_A20 -Type Distribution

New-DistributionGroup -Name C60_CUST1 -Type Distribution

New-DistributionGroup -Name C60_CUST2 -Type Distribution

New-DistributionGroup -Name C60_Hightech -Type Distribution

New-DistributionGroup -Name C60_Public -Type Distribution

New-DistributionGroup -Name C60_Finance -Type Distribution

New-DistributionGroup -Name C60_SCHQ -Type Distribution

New-DistributionGroup -Name C60_EduTeam -Type Distribution

New-DistributionGroup -Name US_C60_Org1 -Type Distribution

New-DistributionGroup -Name US_C60_Org2 -Type Distribution

New-DistributionGroup -Name EU_C60_Org1 -Type Distribution

New-DistributionGroup -Name US_C01_Org1 -Type Distribution

New-DistributionGroup -Name EU_C01_Org1 -Type Distribution

New-DistributionGroup -Name C01_Org1 -Type Distribution

New-DistributionGroup -Name C01_A01 -Type Distribution


Get-DistributionGroup -Identity "*C60*" | Set-DistributionGroup -CustomAttribute4 "C60" -CustomAttribute7 "ORG"

Get-DistributionGroup -Identity "*C01*" | Set-DistributionGroup -CustomAttribute4 "C01" -CustomAttribute7 "ORG"

Get-DistributionGroup -Identity "*_A10*" | Set-DistributionGroup -CustomAttribute9 "A10" -CustomAttribute8 "KR" -CustomAttribute7 "CUST"

Get-DistributionGroup -Identity "*_A20*" | Set-DistributionGroup -CustomAttribute9 "A20" -CustomAttribute8 "KR" -CustomAttribute7 "CUST"

Get-DistributionGroup -Identity "*_A01*" | Set-DistributionGroup -CustomAttribute9 "A01" -CustomAttribute8 "KR" -CustomAttribute7 "CUST"

Get-DistributionGroup -Identity "US*" | Set-DistributionGroup -CustomAttribute8 "US"

Get-DistributionGroup -Identity "EU*" | Set-DistributionGroup -CustomAttribute8 "EU"


Get-Mailbox -Identity "*C60*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute4 "C60" -CustomAttribute7 "CONF"

Get-Mailbox -Identity "*C01*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute4 "C01" -CustomAttribute7 "CONF"

Get-Mailbox -Identity "*_A10*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute9 "A10" -CustomAttribute8 "KR"

Get-Mailbox -Identity "*_A20*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute9 "A20" -CustomAttribute8 "KR"

Get-Mailbox -Identity "*_A01*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute9 "A01" -CustomAttribute8 "KR"

Get-Mailbox -Identity "US*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute8 "US"

Get-Mailbox -Identity "EU*" -RecipientTypeDetails RoomMailbox | Set-Mailbox -CustomAttribute8 "EU"


Add-DistributionGroupMember -Identity C60_Org1 -Member thermidor

Add-DistributionGroupMember -Identity C60_Org2 -Member mstest01

Add-DistributionGroupMember -Identity C60_Hightech -Member mstest02,mstest03

Add-DistributionGroupMember -Identity C60_Public -Member mstest04

Add-DistributionGroupMember -Identity C60_Finance -Member mstest05

Add-DistributionGroupMember -Identity C60_SCHQ -Member mstest06

Add-DistributionGroupMember -Identity C60_EduTeam -Member mstest07





Posted by 떼르미
,


자바스크립트를 허용해주세요!
Please Enable JavaScript![ Enable JavaScript ]