Powershell question (may be)

Welcome Forums General PowerShell Q&A Powershell question (may be)

This topic contains 3 replies, has 3 voices, and was last updated by

Ron
 
Participant
2 years ago.

  • Author
    Posts
  • #59554

    Participant
    Points: 64
    Rank: Member

    Hello,

    I'm finishing up my script that creates new users. Now the problem I'm running into is this:

    We have several departments in HQ, for example Central Approvals Office, my script looks up a user that works in Central Approvals Office and finds that person. The problem is that, HR sometimes, enters CAO instead of Central Approvals Office, and when I run the script, it can't find a user in CAO.

    Without using a bunch of if statements, how would I let PowerShell know CAO is Central Approvals Office

    Thank you,

    Tony

  • #59556

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    You'd have to check for both, either using some kind of "or" clause or two separate searches. PowerShell can't "know" that they're the same thing.

    Alternately, look into solutions that can enforce consistency in AD :).

  • #59559

    Participant
    Points: 64
    Rank: Member

    Thank you, I'm talking with HR about using official department names.

  • #59629
    Ron

    Participant
    Points: 0
    Rank: Member

    This is most likely an Excel problem if the data is coming from HR. They need to add data validation on the department column so they have to choose one that's valid.

The topic ‘Powershell question (may be)’ is closed to new replies.