<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Invoke-NcSsh credential in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127563#M5229</link>
    <description>&lt;P&gt;First of all, you always want to try to use the builtin cmdlets when they are available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look at get-ncsystemversion. &amp;nbsp;That should do the trick. &amp;nbsp; I only tend to use invoke-ncssh when necassary&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2017 17:50:07 GMT</pubDate>
    <dc:creator>JGPSHNTAP</dc:creator>
    <dc:date>2017-01-31T17:50:07Z</dc:date>
    <item>
      <title>Invoke-NcSsh credential</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127561#M5228</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to run SSH commands on a filer but cannot make the credentials work with "Read-Host"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I am doing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$lif = Read-Host "Please enter the node IP address (management LIF)"&lt;BR /&gt;$user = Read-Host "Please enter the username"&lt;BR /&gt;$pass = Read-Host -assecurestring "Please enter your password"&lt;BR /&gt;$password = ConvertTo-SecureString $pass -AsPlainText -Force&lt;BR /&gt;$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password&lt;BR /&gt;Invoke-NcSsh -name $lif -command version -credential $cred&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I am getting:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Invoke-NcSsh : User cannot be authenticated.&lt;BR /&gt;At C:\script.ps1:7 char:1&lt;BR /&gt;+ Invoke-NcSsh -name $lif -command version -credential $cred&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + CategoryInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : InvalidResult: ( [Invoke-NcSsh], SshAuthenticationException&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; + FullyQualifiedErrorId : SshExecFailed,DataONTAP.C.PowerShell.SDK.Cmdlets.Toolkit.Ssh.InvokeNcSsh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 15:30:29 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127561#M5228</guid>
      <dc:creator>kahuna</dc:creator>
      <dc:date>2025-06-04T15:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-NcSsh credential</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127563#M5229</link>
      <description>&lt;P&gt;First of all, you always want to try to use the builtin cmdlets when they are available.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look at get-ncsystemversion. &amp;nbsp;That should do the trick. &amp;nbsp; I only tend to use invoke-ncssh when necassary&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:50:07 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127563#M5229</guid>
      <dc:creator>JGPSHNTAP</dc:creator>
      <dc:date>2017-01-31T17:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-NcSsh credential</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127564#M5230</link>
      <description>&lt;P&gt;You don't need to convert the string to a secure string if you're collecting it as one. &amp;nbsp;This works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$lif = Read-Host "Please enter hostname or LIF address"

$user = Read-Host "Please enter the username"
$pass = Read-Host -assecurestring "Please enter your password"

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$pass

Invoke-NcSsh -Controller $lif -Command version -Credential $cred&lt;/PRE&gt;&lt;P&gt;You could also just prompt for a credential:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$cred = Get-Credential

Invoke-NcSsh ... -Credential $cred&lt;/PRE&gt;&lt;P&gt;I elaborated on this a bit in my post &lt;A href="http://practical-admin.com/blog/netapp-powershell-toolkit-authentication/" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 18:00:40 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127564#M5230</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2017-01-31T18:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-NcSsh credential</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127609#M5233</link>
      <description>&lt;P&gt;thanks guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Prompt is fine. However, I need to run a few commands and send each to a text file (see below). Each time I run Invoke-NcSsh it prompts for credentials which is unacceptable&lt;/P&gt;&lt;P&gt;what I was thinking is either a) find a way to keep the Credentials in cache somehow and let the subsequent commands get it from there, or b) use one command but with some kind of a function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$node = Read-Host "Please enter the node IP address (management LIF)"
$nodename = Read-Host "Please enter the node name"
$cred = Get-Credential

Invoke-NcSsh -name $node -Credential $cred -Command node run -node $nodename -command sysstat -x -c 40 | Out-File C:\sysstat.txt
Invoke-NcSsh -name $node -Credential $cred -Command node run -node $nodename -command ps | Out-File C:\ps.txt
Invoke-NcSsh -name $node -Credential $cred -Command node run -node $nodename -command statit -b 
Invoke-NcSsh -name $node -Credential $cred -Command node run -node $nodename -command statit -e | Out-File C:\statit.txt&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Feb 2017 06:42:17 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127609#M5233</guid>
      <dc:creator>kahuna</dc:creator>
      <dc:date>2017-02-01T06:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-NcSsh credential</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127624#M5238</link>
      <description>&lt;P&gt;B/c you aren't storing your credential cache right when you connect to the controller&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do a man connect-nccontroller -full and look at example on storing credentials.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, read this article.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.adminarsenal.com/blog/secure-password-with-powershell-encrypting-credentials-part-1/" target="_blank"&gt;https://www.adminarsenal.com/blog/secure-password-with-powershell-encrypting-credentials-part-1/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 11:45:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127624#M5238</guid>
      <dc:creator>JGPSHNTAP</dc:creator>
      <dc:date>2017-02-01T11:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Invoke-NcSsh credential</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127625#M5239</link>
      <description>&lt;P&gt;it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is what I did:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$node = Read-Host "Please enter the node IP address (management LIF)"
$nodename = Read-Host "Please enter the node name"
$user = Read-Host "Please enter the username"
Read-Host "Enter Password" -AsSecureString |  ConvertFrom-SecureString | Out-File "C:\ssh\Password.txt"
$pass = Get-Content "C:\ssh\Password.txt" | ConvertTo-SecureString
$File = "C:\ssh\Password.txt"
$MyCredential=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user, (Get-Content $File | ConvertTo-SecureString)
Invoke-NcSsh -name $node -Credential $MyCredential -Command command1 | Out-File C:\command1.txt
Invoke-NcSsh -name $node -Credential $MyCredential -Command command2 | Out-File C:\command2.txt&lt;/PRE&gt;&lt;P&gt;thank you all!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 12:12:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Invoke-NcSsh-credential/m-p/127625#M5239</guid>
      <dc:creator>kahuna</dc:creator>
      <dc:date>2017-02-01T12:12:32Z</dc:date>
    </item>
  </channel>
</rss>

