I need to perform the "split" operation in the $_.Sector and $_.Practice fields of the CSV file IF a ; is present. Then I would need to import the result of the split to each user account so I get the correct multi-value into AD.

Can anyone help me with this command formatting?

by poshoholic at 2012-11-05 06:50:02

If you use the -split operator, that will only perform the split if there is a character to split on. With that in mind, it sounds to me like you want something like this:@{rraSector=@($_.Sector -split ';');rraPractice=@($_.Practice -split ';')}I wrap the results of the split in an array so that you pass an array of strings into these parameter assignments, even if there is only one string in the collection.

This is untested, but it's the first thing I would try. Give that a go and let me know how it works out for you.

by allenr74 at 2012-11-05 08:15:01

Right. I want to split on ;

I will definitely give that a shot and let you know! Thanks!

by allenr74 at 2012-11-05 09:15:34

As I was formatting the command, I have another question....

I would like to put the information before the ; in as an "UPDATE" for the multi-value field and the information after the ; as an "APPEND". Example:

That is the only way the field will be update with 2 values (or more if needed) rather one long string with a ";" in it.

by poshoholic at 2012-11-05 09:48:20

I don't think you can specify update vs append when setting object attributes like that with Set-QADUser. Instead you should get the current attribute value, and then update or append that value depending on what you get from your csv file input, then push the updated/appended value back using Set-QADUser.

by allenr74 at 2012-11-06 07:02:57

Yes, update and then appending does work. I did that in my example above. I'm just struggling with how to split the information in the Sector field of the .CSV file and then put the first part of the split in the UPDATE function and then the second part of the split in the APPEND function.

However, my hr department stated that the order in which the data that is imported from the .CSV file into the rraSector and rraPractice fields should not change. However, during the import, it does change without me doing anything.