sirbounty
asked on
'Really' trimming in powershell
I'm trying to write this data to the Notes field for an AD object, but I'm seeing some extra 'spacing' that I don't want.
First line:first value
Second line: second value [note the leading space]
[this continues to the end]
[and then I have an extra blank line that I don't want, but I realize it's because of my `r`n - how can I remedy?]
Am I missing something in my code that would correct this?
First line:first value
Second line: second value [note the leading space]
[this continues to the end]
[and then I have an extra blank line that I don't want, but I realize it's because of my `r`n - how can I remedy?]
Am I missing something in my code that would correct this?
[string]$info = $infoField.Keys | foreach {if ($infofield.item($_) -ne $null) {
"{0}:{1}`r`n" -f $_.trim(),$infoField.item($_)}}
$attributes.add('info',$info)
And then $attributes is applied to the New-ADGroup with the -otherAttributes parameter...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, but splitting on `n may have done the trick...still testing...
ASKER
Much obliged! :^)
:-)
ASKER
So now I have
First
line:
first
value
Second
line:
second
value