Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Export-CSV centers the column that is being sorted....

$
0
0

I specifically set the variable to align right in the code. It outputs correctly on the screen, but not in the CSV file. How ca i fix it during my export?

# Formatted in the Object
If($FreeSpace -ge 0) {$Properties['FreeSpace']  = "{0,10:N2} MB" -f ($FreeSpace/1MB)}  

#Export CSV - With Problem
$Result | ? {$_.Error -like "$Null"} | Select Name,Drive,FreeSpace,PercentFree,Capacity | sort FreeSpace | Export-CSV $FullPath -Encoding UTF8 -NoType -Force

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles