Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am trying to write a PS script to get status of my snapmirrors.
I need Source Volume, Destination Volume, Status, LagTimeTS, State
However when I view the file the names of the volumes are truncated, and all the columns do not show.
I tried various suggestions I saw from my googled results, but nothing seems to work.
Powershell and I are not well acquainted.
Does anyone have a suggestion ?
thanks!
---- walter
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Walter,
You need to specify the format settings with powershell. I don't take credit for the code below as I found it in another post a long time ago.
ft @ means to set format table(ft) using the conditions specified (@).
Expression is the object/property you want to show
Label is what you want it to show
Width sets the column width
$arrays | foreach-object {$c = Connect-NaController $_ -Credential $cred; Get-Nasnapmirror | Where-Object{$_.LagTime -gt $overLag} | Select Source,Destination,Status,LagtimeTS| ` | |
ft @{Expression={$_.Source};Label="Source";Width=60},@{Expression={$_.Destination};Label="Destination";Width=160},@{Expression={$_.status};Label="status";width=20}, ` | |
@{N='Current Lag Time';E={'{0} days, {1} hrs, {2} mins, {3} secs' -f $_.LagTimeTS.days, $_.LagTimeTS.Hours, $_.LagTimeTS.Minutes, $_.LagTimeTS.Seconds}}} |
-Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Scott,
I finally figured out that I can use foreach-object.and was able to get the info I wanted.
Powershell is overly complex in my opinion.
--- walter
