Use to upper in pipe

Brass Contributor



I'd like to get all my "text" in uppercase right before sending it to CSV.

Is this possible and how? (I don't want to do it anytime earlier in my script). I know the "string".ToUpper() method but no idea how to use something similar here.


$hash.GetEnumerator() | Sort-Object $_.keys | ForEach-Object{[PSCustomObject]$_.value } | Sort-Object TimeID -Descending | Export-Csv "$hash" -NoTypeInformation -delimiter ";"


Thank you.

4 Replies
best response confirmed by John_Dodo (Brass Contributor)
You can convert values to uppercase like this: (It will create a new hashtable with all values in uppercase
foreach ($key in $hash.Keys) {
$newhash[$key] = $hash[$key].ToUpper()
Did this answer your question?
Yes. Thank you!
Good to hear! Please mark my answer as solution to mark it as solved