Aligning columns in Out-GridView

Welcome Forums General PowerShell Q&A Aligning columns in Out-GridView

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 2 months ago.

  • Author
  • #5410

    Points: 0
    Rank: Member

    by FilippoNeri at 2013-01-08 03:19:40

    Hi Folks,
    I've created a PowerShell script to display logical disk information on a local or remote computer.
    Is it possible to right align a column in a grid?
    I use PowerShell version 2.

    param( [string]$m=$env:ComputerName )
    Write-Host ""
    Write-Host "Drive Information for $m"
    $LD=Get-WmiObject Win32_LogicalDisk -ComputerName $m -Filter "driveType=3"
    $Size=@{Label="Size"; Expression={"{0:N2} GB" -f ($_.Size/1GB)}}
    $FreeSpace=@{Label="Free Space"; Expression={"{0:N2} GB" -f ($_.FreeSpace/1GB)}}
    $FreePercent=@{Label="Free %"; Expression={ "{0:P2} " -f ($_.FreeSpace/$_.Size) } }
    $LD | Select-Object DeviceID, VolumeName,$Size, $FreeSpace, $FreePercent | Out-GridView -Title "Logical Drives on $m"

    by DonJ at 2013-01-08 08:30:17


The topic ‘Aligning columns in Out-GridView’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort