NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Microsoft Virtualization Discussions

Ask the Experts: NetApp PowerShell Question

storageguy
4,612 Views

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
4,487 Views

Try this

 

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

                                               Takeover Enabled: true

Public