Solved

Excel / Powershell  If statement with 3 variables

Posted on 2014-09-11
2
209 Views
Last Modified: 2014-09-11
Dear experts,

could anybody help me with this formula below?

If GAL =  -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&

if GUL = -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"

all other not GUL or GAL = -CustomAttribute4 '"&P2&"  -CustomAttribute10 'LT' -CustomAttribute14 'HAD'
and SMTP =  '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"  (same as "GUL")

I tried this behind but failed ;)  Thanks in advance!


="Start-Sleep -s 10;Set-Mailbox "&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),&" -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&"' -Identity "&A2&"",A2&" -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"'-Identity "&A2&"))"

="Start-Sleep -s 10;Set-Mailbox "&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),&" -CustomAttribute4 'T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"','smtp:"&H2&"' -Identity "&A2&"",A2&" -CustomAttribute4 'T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"','"&J2&"','"&K2&"','SMTP:"&F2&"','smtp:"&G2&"'-Identity "&A2&"))"

Open in new window

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 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40316712
pls try

="Start-Sleep -s 10;Set-Mailbox  -CustomAttribute4 '"&IF(ISERROR(SEARCH("GAL",L2)),IF(ISERROR(SEARCH("GUL",L2)),P2&"' -CustomAttribute10 'LT' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2,"T' -CustomAttribute10 'LTS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2),"T' -CustomAttribute8 'LS' -CustomAttribute10 'LS' -CustomAttribute14 'HAD' -EmailAddressPolicyEnabled $false -SingleItemRecoveryEnabled $true -EmailAddresses '"&I2&"';'"&J2&"';'"&K2&"';'SMTP:"&F2&"';'smtp:"&G2&"';'smtp:"&G2)&"' -Identity "&A2
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40316886
perfect as usual. Great work!
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 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