Microsoft Virtualization Discussions

Ask the Experts: NetApp PowerShell Question

storageguy

Hello PS Gurus,

 

I have issue combining Invoke-NcSsh and Select-string. 

 

PS C:\Users\user1> Invoke-NcSsh "storage failover show -node $Node" |select-string "Takeover Enabled"           ( Select-string doesn't work)


Node: mars1
Partner Name: mars2
Node NVRAM ID: 18739555555
Partner NVRAM ID: 1874666666
Takeover Enabled: true
HA Mode: ha
Takeover Possible: true
Reason Takeover not Possible: -
Interconnect Up: true
Interconnect Links: RDMA Interconnect is up (Link 0 up (active), Link 1 up)
Interconnect Type: Infiniband ( Mellanox ConnectX )
State Description: Connected to mars2
Partner State: Up
Time Until Takeover: -
Reason Takeover not Possible by Partner: -
Auto Giveback Enabled: false
Check Partner Enabled: true
Takeover Detection Time (secs): 15
Takeover on Panic Enabled: true
Takeover on Reboot Enabled: true
Delay Before Auto Giveback (secs): 600
Hardware Assist Enabled: true

......

But when I put the output to a file and then pass it select-string it works.

Invoke-NcSsh "storage failover show -node $Node" >filer.txt

select-string "Takeover Enabled" filer.txt

filer.txt:9: Takeover Enabled: true

 

What am I doing wrong here? Thanks

 

1 REPLY 1

NGPENGLIANG

Try this

 

Invoke-NcSsh "storage failover show -node $node"  | out-string -Stream | Select-String "Takeover Enabled"

                                               Takeover Enabled: true

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public