Subscribe
Accepted Solution

out-file - full page

When I output to a file it only takes half the page, 'wraps' the text and cuts the end off - how do I get it on a full page with full lines?

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Get-NaSnapmirror -Location vol_01 | select source, destination, status, lagtimets | ft -Autosize | Out-File c:\sm_status.txt -Append

Source                    Destination              Status   LagTime
                                                                    TS
------                    -----------              ------   -------

source02:vol_01       destination05:vol_01        transferring       7.00...

Re: out-file - full page

Try this:

Get-NaSnapmirror -Location vol_01 | select source, destination, status, lagtimets | ft -Autosize | out-string -width 200 | Out-File c:\sm_status.txt -Append

If that's not wide enough adjust the width.

Sent from my Windows Phone

Re: out-file - full page

You should use something like this.

Define your lagtime -

$snapMirrors = Get-NaSnapmirror | Where-Object {$_.lagTime -gt $lagtimeseconds}

  $snapMirrors | ft @{expression={$_.sourcelocation};Label="Source";Width=20}`

,@{expression={$_.destinationlocation};Label="Destination Location";Width=20} `

,@{expression={$_.status};Label="Status";Width=20} `

    ,@{N='Current Lag Time';E={'{0} hrs, {1} mins, {2} secs' -f $_.LagTimeTS.Hours, $_.LagTimeTS.Minutes, $_.LagTimeTS.Seconds}} `

,@{expression={ConvertTo-FormattedNumber $_.transferprogress DataSize "0.0"};Label="Current Progress";Width=20} `

,@{expression={ConvertTo-FormattedNumber $_.lasttransfersize Datasize "0.0"};Label="Last Transfer size";Width=20} `

     ,@{N='Last Transfer Time';E={'{0} hrs, {1} mins, {2} secs' -f  $_.LastTransferDurationTS.Hours, $_.LastTransferDurationTS.Minutes, $_.LastTransferDurationTS.Seconds}} `

  -groupby @{expression={$C};Label="Filer"} -autosize  |  Out-String -Width 1000 | Out-File $totaloutfile -append