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?
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.
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
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.
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 )