I have this script in a workflow and this line fails when I use a variable
set-Qaduser -identity agntest\$usr -ObjectAttributes @{employeetype = $UserEmpType}
If I put text it works fine.
set-Qaduser -identity agntest\$usr -ObjectAttributes @{employeetype = 'TextWorks"}
I know the variable is correct because I did a output to a file. It just has a few number characters.
This is the error in the log when the variable causes failure: At line: 39 char:13. Exception has been thrown by the target of an invocation.
How do I use a variable correctly in that command?