Help with a switch statement

Welcome Forums General PowerShell Q&A Help with a switch statement

Viewing 4 reply threads
  • Author
    Posts
    • #260211
      Participant
      Topics: 9
      Replies: 14
      Points: 183
      Rank: Participant

      I am using a switch statement with an import of a CSV in a Foreach loop. I am not sure what I am doing wrong. Within the csv I have a column called company which will provide a 4 digit number example of this 9020. In my switch statement depending on what company you are from it will or should place you in a particular OU in AD. The code below is what I am working with in my test lab.

    • #260217
      Participant
      Topics: 12
      Replies: 541
      Points: 1,314
      Helping Hand
      Rank: Community Hero
    • #260235
      Participant
      Topics: 9
      Replies: 14
      Points: 183
      Rank: Participant

      <link rel=”stylesheet” type=”text/css” href=”https://powershell.org/wp-content/plugins/urvanov-syntax-highlighter/themes/powershell-ise/powershell-ise.css”&gt;
      <link rel=”stylesheet” type=”text/css” href=”https://powershell.org/wp-content/plugins/urvanov-syntax-highlighter/fonts/liberation-mono.css”&gt;

      Thank you for the reply @Sam Boutros. I have made the change in the script, but apparently it doesn’t like it.

    • #260259
      Participant
      Topics: 12
      Replies: 541
      Points: 1,314
      Helping Hand
      Rank: Community Hero

      <link rel=”stylesheet” type=”text/css” href=”https://powershell.org/wp-content/plugins/urvanov-syntax-highlighter/themes/powershell-ise/powershell-ise.css”&gt;

      <link rel=”stylesheet” type=”text/css” href=”https://powershell.org/wp-content/plugins/urvanov-syntax-highlighter/fonts/liberation-mono.css”&gt;

      Thank you for the reply @Sam Boutros. I have made the change in the script, but apparently it doesn’t like it.

      <link rel=”stylesheet” type=”text/css” href=”https://powershell.org/wp-content/plugins/urvanov-syntax-highlighter/themes/powershell-ise/powershell-ise.css”&gt;
      <link rel=”stylesheet” type=”text/css” href=”https://powershell.org/wp-content/plugins/urvanov-syntax-highlighter/fonts/liberation-mono.css”&gt;

      You’re passing the $ADDept to the -Path parameter, where you’re putting bad values like “OU=Staff,OU=PrintShop-9033,OU=Osprey,OU=District Departments,DC=testlab,DC=local”
      Users belong in a container like “CN=Staff,OU=PrintShop-9033,OU=Osprey,OU=District Departments,DC=testlab,DC=local” not in an OU..

    • #260316
      Participant
      Topics: 9
      Replies: 14
      Points: 183
      Rank: Participant

      I have it working now. You helped in the first reply. Below is what is working for me now. Thank you for the replies.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.