Data ONTAP® PowerShell Toolkit

Switch to clustered Data ONTAP documentation.

Cmdlet: Invoke-NaSsh


NAME
Invoke-NaSsh

SYNOPSIS
Send a Data ONTAP CLI command via SSH.

SYNTAX
Invoke-NaSsh -Command <String[]> [-Credential <PSCredential>] [-Port <Int32>
] [-Timeout <Int32>] [<CommonParameters>]

Invoke-NaSsh -Name <String> -Command <String[]> [-Credential <PSCredential>]
[-Port <Int32>] [-Timeout <Int32>] [-Username <String>] [-Passphrase <Secur
eString>] [-PrivateKeyFile <String>] [<CommonParameters>]

Invoke-NaSsh -Controller <NaController> -Command <String[]> [-Credential <PS
Credential>] [-Port <Int32>] [-Timeout <Int32>] [<CommonParameters>]


DESCRIPTION
Send a Data ONTAP CLI command via SSH.

This cmdlet is useful for querying or manipulating Data ONTAP if a more spec
ific PowerShell cmdlet is not available. It may also be used to to interact
with Data ONTAP in lieu of opening a terminal connection to the controller.


PARAMETERS
-Command <String[]>
The command string to send to Data ONTAP. If the command string contain
s hyphens, enclose the command in quotes lest PowerShell attempt to inte
rpret those as cmdlet arguments.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-Credential <PSCredential>
Use this argument to explicitly provide SSH credentials for authenticati
ng with Data ONTAP. If credentials are provided, they take precedence o
ver any other credentials that may be available. If not provided, the c
mdlet will look for valid credentials from either the specified NaContro
ller object or $global:CurrentNaController as appropriate. Failing that
, credentials will be sought in the Toolkit's credential cache.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Port <Int32>
The port on which to connect to the storage controller.

Required? false
Position? named
Default value 22
Accept pipeline input? false
Accept wildcard characters? false

-Timeout <Int32>
Connection timeout in milliseconds.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Name <String>
The name or address of the controller to connect to. If a hostname is s
pecified, it must be resolvable to an IP address. Specify either this a
rgument or the -Controller argument, but not both.

Optionally, specify the user in the <user>@<hostname> format. If this f
ormat is specified, the cmdlet will attempt to authenticate the user usi
ng private key authentication.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-Username <String>
Specify the username to log in as using the private key file. If the Na
me parameter is specified in the <user>@<hostname> format, this paramete
r is ignored.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Passphrase <SecureString>
Passphrase required for the private key file. If not specified, the pri
vate key does not require a passphrase.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-PrivateKeyFile <String>
Full path to the private key file to use to authenticate the connection.
If not specified, the $DataONTAP_SSHPrivateKeyFile variable is consult
ed. The $DataONTAP_SSHPrivateKeyFile variable may contain one or more p
aths to private key files, or directories containing private key files.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Controller <NaController>
The controller to connect to, embodied in an NaController object as retu
rned by Connect-NaController. Specify either this argument or the -Name
argument, but not both.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS



OUTPUTS
System.String


NOTES


Category: toolkit

-------------- Example 1 --------------

C:\PS>Connect-NaController dunn
Invoke-NaSsh aggr status


Connect to controller 'dunn' and send a CLI command via SSH. Both of the cm
dlets in this example leverage the Toolkit's credentials cache, although bot
h also accept explicit credentials.


Aggr State Status Options
aggr0 online raid_dp, aggr root
redirect
aggr1 online raid_dp, aggr snapshot_autodelete=off
aggr2 online raid_dp, aggr


-------------- Example 2 --------------

C:\PS>Invoke-NaSsh -Name dunn -Credential root "ifconfig -a"


Send a command via SSH using a specific hostname and credentials.


e0a: flags=0x2d48867<UP,BROADCAST,RUNNING,MULTICAST,TCPCKSUM> mtu 1500 dad_a
ttempts 2
inet 10.61.167.60 netmask-or-prefix 0xffffff00 broadcast 10.61.167.2
55
inet6 fe80::2a0:98ff:fe06:c227 prefixlen 64 scopeid 0x4 autoconf
partner e0a (not in use)
ether 00:a0:98:06:c2:27 (auto-1000t-fd-up) flowcontrol full
e0b: flags=0x2548867<UP,BROADCAST,RUNNING,MULTICAST,TCPCKSUM> mtu 1500 dad_a
ttempts 2
inet6 fe80::2a0:98ff:fe06:c226 prefixlen 64 scopeid 0x3 autoconf ten
tative
ether 00:a0:98:06:c2:26 (auto-unknown-down) flowcontrol full
e0c: flags=0x2d48867<UP,BROADCAST,RUNNING,MULTICAST,TCPCKSUM> mtu 1500 dad_a
ttempts 2
inet6 fe80::2a0:98ff:fe06:c225 prefixlen 64 scopeid 0x2 autoconf
ether 00:a0:98:06:c2:25 (auto-1000t-fd-up) flowcontrol full
e0d: flags=0x2548867<UP,BROADCAST,RUNNING,MULTICAST,TCPCKSUM> mtu 1500 dad_a
ttempts 2
inet6 fe80::2a0:98ff:fe06:c224 prefixlen 64 scopeid 0x1 autoconf ten
tative
ether 00:a0:98:06:c2:24 (auto-unknown-down) flowcontrol full
lo: flags=0x1948049<UP,LOOPBACK,RUNNING,MULTICAST,TCPCKSUM> mtu 8160
inet 127.0.0.1 netmask-or-prefix 0xff000000 broadcast 127.0.0.1
inet6 fe80::1 prefixlen 64 scopeid 0x5 autoconf
inet6 ::1 prefixlen 128
ether 00:00:00:00:00:00 (VIA Provider)


-------------- Example 3 --------------

C:\PS>Invoke-NaSsh -Name root@10.61.169.28 -PrivateKeyFile C:\ssh\privatekey
-Command "vol status"


Invoke the "vol status" command over SSH. Use the specified private key fil
e for authentication.





-------------- Example 4 --------------

C:\PS>$passphrase = Read-Host -AsSecureString "Passphrase"
Passphrase: ************
Invoke-NaSsh -Name root@10.61.169.28 -PrivateKeyFile C:\ssh\privatekey -Comm
and "vol status" -Passphrase $passphrase


Invoke the "vol status" command over SSH. Use the specified private key fil
e for authentication and prompt for the passphrase.


Volume State Status Options
vol0 online raid_dp, flex root, maxdirsize=28835
sis
luns online raid_dp, flex create_ucode=on,
sis convert_ucode=on, guarante
e=none,
fractional_reserve=0
cifs online raid_dp, flex guarantee=none,
sis fractional_reserve=0


-------------- Example 5 --------------

C:\PS>$DataONTAP_SSHPrivateKeyFile = "C:\ssh\privatekey"
Invoke-NaSsh -Name root@10.61.169.28 -Passphrase $passphrase -Command "vol s
tatus"


Invoke the "vol status" command over SSH. Use the private key file specifie
d in the $DataONTAP_SSHPrivateKeyFile variable and use the passphrase create
d in Example 4.


Volume State Status Options
vol0 online raid_dp, flex root, maxdirsize=28835
sis
luns online raid_dp, flex create_ucode=on,
sis convert_ucode=on, guarante
e=none,
fractional_reserve=0
cifs online raid_dp, flex guarantee=none,
sis fractional_reserve=0


-------------- Example 6 --------------

C:\PS>Invoke-NaSsh -Name root@192.168.0.102 -Passphrase (ConvertTo-SecureStr
ing "passphrase" -Force -AsPlainText) -Command "vol status"


Invoke the "vol status" command over SSH. Use the private key file specifie
d in the $DataONTAP_SSHPrivateKeyFile variable and use the plaintext passphr
ase.


Volume State Status Options
vol0 online raid0, flex root, no_atime_update=on,
create_ucode=on,
convert_ucode=on,
maxdirsize=2621



RELATED LINKS
Connect-NaController
Add-NaCredential







 Data ONTAP® PowerShell Toolkit