0

I am having some issues with getting a part of my script to work.

Say that $SEMFINAL = /O=Default/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name1 [email protected]

IF ($SEMFINAL -match "name1 [email protected]") {Set-variable -name SEMIFINAL -value "[email protected]"}

I have tried using set-variable and just $A = B but it isnt working.

1 Answer 1

1

You need to wrap your string in single quotes:

$SEMFINAL = '/O=Default/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=name1 [email protected]'

then:

IF ($SEMFINAL -match "name1 [email protected]") {$SEMFINAL = "[email protected]"}

Sign up to request clarification or add additional context in comments.

2 Comments

Thats weird I dont see why that shouldnt work but I tested it in my ps environment and it doesnt set $SEMFINAL correctly but if I do IF ($SEMFINAL -match "name1 [email protected]") {$test = "[email protected]"} then $test has the correct value
sets correctly for me - check for semifinal (instead of semfinal) typo in your code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.