NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

ONTAP Discussions

Invoke-NcSsh : Exception has been thrown by the target of an invocation (ISE vs POWERSHELL)

SOBOU
1,732 Views

Good day all.  I need to pick your brains for a second.

 

Import-Module DataONTAP

$StorageIP = "10.10.1.40"

$user = "Power"

Connect-NcController $StorageIP -Credential $user -ontapi
Invoke-NcSsh -Command 'set -confirmations off'

 

When running those in Powershell ISE, it works fine, but when running this in regular Powershell window, i get the "Invoke-NcSsh : Exception has been thrown by the target of an invocation"

 

I have already checked a couple things

Running this from a server 2022, got the latest ontap module 9.17, running against a 9.12 SAN. 

i have putty installed. Putty path is in the $env:path

.  Both instances of ISE and Powershell are run using regular user (not as admin)... Putty registry keys are present, etc.. 

When i type get-module, the only difference between both is the ISE module that is present in the ISE window.

 

Have you ever experienced this?

I have included a screenshot of both screens so you can see the results.  Obviously that is not all the script does, but it is stuck there atm.  

 

 

2 REPLIES 2

chamfer
1,448 Views

@SOBOU is your PowerShell running in constrained language mode?

 

Check by running the following in both PowerShell ISE and you regular PowerShell:

$ExecutionContext.SessionState.LanguageMode

 

If you are in "ConstrainedLanguage" in your normal PowerShell this is the reason for the difference.

SOBOU
1,432 Views
That was one thing I hadn't tried but it shows Full on both ISE or Powershell.

Tks for the suggestion
Public