Solved

Set EXchange Custom Attributes related to company with hash table?

Posted on 2013-05-24
4
470 Views
Last Modified: 2013-05-27
hi,

My problem is to create a hash-table to set the correct custom attributes.

Set-Mailbox -CustomAttribute3 'Q' -CustomAttribute12 'ER' -CustomAttribute11 'EMC' -SingleItemRecoveryEnabled $true -Identity $User.userid

Open in new window


The C_attribute 3 related to the company attribute.  1 company should set to value "D"
1 company to value "F" all other to "Q"

The C_attribute 12 should set for about 6 different companies to "ZE" for 3 companies
to KU and to all other to "ER".

$compattrib3 = @{

 "contoso" = ''D"
 "contoso2" = "F"
 "All other" = 'Q'
 
$compattrib12 = @{
"contoso" = ''ZE"
 "contoso2" = "KU"
 "All other" = "ER"

Thank you so much for your help.


Mandy!
0
Comment
Question by:Mandy_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39195917
$compattrib3 = @{
"contoso" =  "D"
"contoso2" = "F"
"All other" = "Q"
}

$compattrib12 = @{
"contoso" = "ZE"
"contoso2" = "KU"
"All other" = "ER"
}

Set-Mailbox -CustomAttribute3 $compattrib3."All other" -CustomAttribute12 $compattrib12."All other" -CustomAttribute11 'EMC' -SingleItemRecoveryEnabled $true -Identity $User.userid

Open in new window

0
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 39198009
So, you've already got the hash table, you just need If statements (or possibly a Switch) to check for all the possibilities and execute the Set-Mailbox command with the different values accordingly.  An example is shown below.

If ($user.company -eq "EMC")
{
    Set-Mailbox -CustomAttribute3 $compattrib3."contoso" -CustomAttribute12 $compattrib12."contoso" -CustomAttribute11 'EMC' -SingleItemRecoveryEnabled $true -Identity $User.userid
}
ElseIf ($user.company -eq "LDE" -or $user.company -eq "DMB" -or $user.company -eq "REX")
{
    Set-Mailbox -CustomAttribute3 $compattrib3."contoso2" -CustomAttribute12 $compattrib12."contoso2" -SingleItemRecoveryEnabled $true -Identity $User.userid
}
Else
{
    Set-Mailbox -CustomAttribute3 $compattrib3."All other" -CustomAttribute12 $compattrib12."All other" -SingleItemRecoveryEnabled $true -Identity $User.userid
}

Open in new window

0
 
LVL 2

Author Comment

by:Mandy_
ID: 39198820
Thank you so much. mandy
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 39198821
thank you
0

Featured Post

IoT Devices - Fast, Cheap or Secure…Pick Two

The IoT market is growing at a rapid pace and manufacturers are under pressure to quickly provide new products. Can you be sure that your devices do what they're supposed to do, while still being secure?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A hard and fast method for reducing Active Directory Administrators members.
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question