ONTAP Discussions

When executing an ONTAP command thru PowerShell using plink or Invoke-NcSSH I am getting an error

tadinifni

I am baffled by this particular issue and need some help. 

 

I wrote a PowerShell script to add a role to several NetApp controllers. The command is as follows:

$commands =  'security login role modify -role netapp-harvest-role -access readonly -cmddirname cluster identity show '

The error says: "  Error: "identity" was not expected. Please specify -fieldname first.  

 

However, I ran the command on the cluster CLI and it works without a problem. Its not accepting the second argument in the -cmddirname  attribute. However, it does work with a single argument in this command.

 

I tried directly with "plink.exe" and  "Invoke-NcSSH"  but neither of them worked.

Here is the command syntax for both.

 

Invoke-NcSSH

Invoke-NcSsh -Command $commands -Controller $controllerip -Credential $credentials

 

PLINK

plink.exe -ssh $controllerip -l $username -pw $secondpass -batch $commands

 

I am not sure whats wrong, but could use some help with this one.

 

Anyone have any ideas????

Thanks!

1 ACCEPTED SOLUTION

hmoubara

Hello,

 

When running the command syntax, use the {} for the command after cmddirname like in the example below:

 

$commands =  'security login role modify -role netapp-harvest-role -access readonly -cmddirname {cluster identity show} '

 

Let me know if this answer your question.

 

Thanks 

View solution in original post

2 REPLIES 2

tadinifni

That solved my issue. 

Thanks for the help!

hmoubara

Hello,

 

When running the command syntax, use the {} for the command after cmddirname like in the example below:

 

$commands =  'security login role modify -role netapp-harvest-role -access readonly -cmddirname {cluster identity show} '

 

Let me know if this answer your question.

 

Thanks 

View solution in original post

Announcements
Register for Insight 2021 Digital

INSIGHT 2021 Digital: Meet the Specialists 2

On October 20-22, gear up for a fully digital, totally immersive virtual experience with a downright legendary lineup of world-renowned specialists. Tune in for visionary conversations, solution deep dives, technical sessions and more.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public