Author Posts

March 26, 2014 at 9:52 am

I am reading data from an SQL table and one of the fields, being a note field, has data on two or more lines. I'd like to maintain that multi-line format in my output so that the result is similar to what's below.

[b]UserID[/b] : jdandy
[b]FirstName[/b] : Jim
[b]LastName[/b] : Dandy
[b]Notes[/b] : MMN: Smith
COB: Athens

What I'm getting instead is:

[b]UserID[/b] : jdandy
[b]FirstName[/b] : Jim
[b]LastName[/b] : Dandy
[b]Notes[/b] : MMN: Smith COB: Athens

Is there some way to format the output string to maintain the multi-line notes?

March 26, 2014 at 10:01 am

It's probably a difference in the carriage return character being used in the database vs. what PowerShell uses. Can you look and see if there's an actual CR and LF in the data?

March 26, 2014 at 12:49 pm

That was it exactly, thanks. I also needed to find a method of keeping the array intact when I edited this data and this I was able to do using an array.

Cool stuff, this PowerShell