Microsoft Virtualization Discussions

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

I have been noticing some interesting things when running the powershell toolkit with the latest putty in windows 10. I have set the execution policy on maching to unrestricted. Previously I would just right click my .PS1 file and run with powershell and everything would work fine. Now when I run things this way I get the following error.

 

PS>TerminatingError(Invoke-NcSsh): "Requested registry access is not allowed."
Invoke-NcSsh : Requested registry access is not allowed.

 

 

If I open powershell as an admin and run from the command line that error goes away. Any ideas?

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

This is a result of the fix for the broken Invoke-NcSsh cmdlet with the newest versions of ONTAP...it uses PuTTY to make the SSH call now instead of a library shipped with PSTK.  The error you're seeing is because behind the scenes it's accessing the registry to, I believe, determine the location of the PuTTY (or, rather, plink) executable.  Normally, that registry key requires administrator level privileges to access, hence why you see the error go away when using an elevated PowerShell prompt.

 

You can "fix" it by adjusting the permissions on the the key, as described here.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

One issue I encountered on W2K12R2, even after installing Putty 64-bit V0.70, was that PowerShell kept saying:

     Please install putty (version putty-64bit-0.70) on your machine to use this cmdlet.

 

I used SysInternal's 'Procmon.exe' utility to monitor PowerShell's access to the registry, and I saw that it was looking for this registry key:
   HKCU\SOFTWARE\SimonTatham\PuTTY64

 

It turned out that my W2K12R2 server didn't have a registry key called 'PuTTY64', it had 'PuTTY'.  I added '64' to the registry key, so it looked like 'PuTTY64', and then the InovkeNcSsh cmdlet worked like it was supposed to.

 

I suspect that I had a 32-bit version of PuTTY installed prior to installing the 64-bit version, and the registry key didn't get updated to 'PuTTY64', since it already existed.

 

I made sure that the permission were as described elsewhere in a the thread that asulliva linked to:

   All application packages: Full Control
   Users (of the local machine your on): Full Control

 

I hope that this information helps others who are trying to get the InovkeNcSsh cmdlet to work.

 

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

After following all the required instructions and troubleshooting steps we are still receiving the same error:

 

 

Invoke-NcSsh : An established connection was aborted by the software in your host machine.

 

 

- Windows Server 2012 R2 (Version 6.3 Build 9600)

 

- NA PSTK 4.6.0

 

get-natoolkitversion

Major  Minor  Build  Revision
-----  -----  -----  --------
4      2      0      0

 

- Putty release 0.70 (32/64) installed in native Path: C:\Program Files (x86)\PuTTY // C:\Program Files\PuTTY

 

- ONTAP 9.3P2

 

- granted permissions "Full Controll" to "All application packages" in registry for "HKEY_LOCAL_MACHINE"\SOFTWARE\SimonTatham"

 

- copied putty and plink to "C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\DataONTAP"

 

- rebooted server

 

 

Commands are working fine for ONTAP 9.2 systems from the same enviroment.

 

What are we missing? Any hints?

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

security login show to the cluster admin vserver.  That needs to have ssh access associated to the grouip/user you are using invoke-ncssh

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

Thanks for your quick response.

Local netapp admin user already had ssh access obviously.

I tried to add the windows user who starts the script aswell but error remains the same.

By calling "Invoke-NcSsh" the windows user establish a ssh connection to the netapp via putty now?

Highlighted

Re: Invoke-NcSsh failing with ONTAP 9.3

I was able to finally resolve this by:

1) Run Powershell v5.x or higher
2) Install only the newest Powershell tools from Netapp (9.x)
3) Add the user to "full" control of the Putty reg keys (I created both HKEY_CURRENT_USER\Software\SimonTatham\PuTTY and HKEY_CURRENT_USER\Software\SimonTatham\PuTTY64 reg key trees)
4) Launch PS "As Administrator" ( start-process powershell -verb RunAs )

Try the NEW Knowledgebase!
NetApp KB Site
Forums