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

Adding date to my output in this below ps script

$
0
0

Below is my script...

foreach ($Server in (Get-Content C:\psfiles\Winservers.txt)){
    Get-WmiObject win32_logicalDisk -ComputerName $Server | Select @{
        Expression={$Server};label="ServerName"},DeviceID,Volumename ,@{Expression={
        $_.Size /1Gb -as [int]};Label="Total Size(GB)"},@{Expression={($_.Size /1Gb
        -as [int])
        - ($_.Freespace/ 1Gb -as [int])};Label="InUse Size (GB)"} ,
           @{Expression={$_.Freespace / 1Gb -as     [int]};Label="FreeSize(GB)"},
           @{Expression={(($_.Freespace /1Gb -as [float]) / ($_.Size / 1Gb -as              
           [float]))*100};Label="FreeSpace (%)"},$(Get-Date -format 'd')
        | format-table

right now..i get the output as below

servername  deviceid  volumename  totalsize............10/6/2014 

srv1           c:       data          100                 null

srv2            d:      bkup           50                  null

I want to get the result as

servername       deviceid volumename totalsize............createdt 

srv1                c:       data          100            10/16/2014 

srv2                d:        bkup          50             10/6/2014
Thanks In Advance!

Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images