Data ONTAP PowerShell Toolkit - Emulate console connection

by Extraordinary Contributor on ‎2011-02-11 11:46 AM - edited on ‎2014-09-25 12:35 PM by allison Former NetApp Employee

How often have you tried to telnet to a Data ONTAP controller, only to be greeted with the message:

 

Too many users logged in!  Please try again later.


C
onnection to host lost.

 

Here is a script that uses the new Invoke-NaSsh cmdlet in Toolkit 1.3 to emulate a console connection.  It works regardless of any other users logged in.  Like Invoke-NaSsh on which it is based, this script accepts a name or address value or an NaController object (argument 0), or the value in $global:CurrentNaController.  Similarly, credentials may be supplied explicitly (argument 1), embedded in an NaController object, or via the credentials cache.  Just enter 'exit' or Ctrl-C to return to PowerShell.

 

PS C:\> Connect-NaController benson
PS C:\> .\Connect-NaControllerConsole.ps1
benson: aggr status
           Aggr State           Status            Options
          aggr0 online          raid_dp, aggr     root
          aggr1 online          raid_dp, aggr

 

benson:

 

Commands that don't terminate on their own, such as sysstat, will cause Invoke-NaSsh to hang.  In a case like that, just ensure the output is bounded:

 

PS C:\> .\Connect-NaControllerConsole.ps1 dunn
dunn: sysstat -c 5
CPU    NFS   CIFS   HTTP      Net kB/s     Disk kB/s      Tape kB/s    Cache
                               in   out     read  write    read write     age
  0%      0      0      0       0     0       16      0       0     0     >60
  0%      0      0      0       0     0        8     24       0     0     >60
  0%      0      0      0       0     0        0      0       0     0     >60
  1%      0      3      0       8     9       40      8       0     0     >60
  1%      0      0      0       0     0        8     24       0     0     >60

 

dunn:

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.