Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $columns = ($datatable | Get-Member -MemberType Property).Name
- foreach($column in $Columns) {
- $max = 0
- foreach ($a in $datatable){
- if($max -lt $a.$column.length){
- $max = $a.$column.length
- }
- }
- $output = New-Object psobject
- $output | Add-Member NoteProperty Column ($column)
- $output | Add-Member NoteProperty Max ($max)
- Write-Output $output
- }
- Column Max
- A 3
- A 4
- A 5
- B 10
- C 19
- C 29
- D 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement