Announcement

Collapse
No announcement yet.

Need Help Formatting Columns in Excel using Powershell and maybe adding a chart!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need Help Formatting Columns in Excel using Powershell and maybe adding a chart!

    Would anyone know how to take my current powershell script which displays server space from a current list of servers into an excel spreadsheet and makes the data autofit into the cells? I would also like to make this script display a chart in Excel as well if possible. Any help would be appreciated.

    Code:
     
    $servname = Get-Content c:\FSserv.txt
    Get-WmiObject win32_logicalDisk -ComputerName $servname | Where-Object {$_.VolumeName -like "JH*R*"} | select-object `
        DeviceID,VolumeName, `
        @{label="Size";Expression={"{0:n2}" -f ($_.Size/1GB)}},
        @{label="FreeSpace";Expression={"{0:n2}" -f ($_.FreeSpace/1GB)}},
        @{label="%Free";Expression={"{0:p2}" -f ($_.FreeSpace/$_.Size)}} | Export-CSV c:\jhFSfreespace.csv -NoTypeInformation
    Last edited by Rems; 27th March 2012, 12:37. Reason: added CODE-tags

  • #2
    Re: Need Help Formatting Columns in Excel using Powershell and maybe adding a chart!

    Did you manage to write the code? I might have it if you still need help.

    Comment

    Working...
    X