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.
Connection 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: