Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set EXchange Custom Attributes related to company with hash table?

Posted on 2013-05-24
4
Medium Priority
?
472 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 41

Accepted Solution

by:
footech earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

730 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