2 weeks ago - last edited 2 weeks ago
Mainly documenting this here in case anyone else runs into this.
I was testing out a WFA command to rename a node and was getting errors about NonInteractive mode when testing the command.
Output from the command test:
20:29:20.316 INFO [Rename Node] ### Command 'Rename Node' in 'POWER_SHELL' ### 20:29:22.863 INFO [Rename Node] Get-WfaCredentials -Host primary_cluster 20:29:22.894 INFO [Rename Node] Credentials successfully provided for 'primary_cluster' 20:29:22.941 INFO [Rename Node] Connect-Controller -Type CLUSTER -Name primary_cluster -Credential System.Management.Automation.PSCredential -Vserver 20:29:23.222 INFO [Rename Node] Connect-NcController (with credentials) -Name primary_cluster -Timeout 60000 -ErrorAction Stop -Port 443 -SSLVersion TLSv1.2 20:29:25.097 INFO [Rename Node] Connected to cluster node 20:29:25.113 INFO [Rename Node] Renaming node 'test' with new name of 'test2' on Cluster 'primary_cluster' 20:29:25.191 ERROR [Rename Node] Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available. 20:29:25.300 ERROR [Rename Node] Failed executing command. Exception: Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.
I ran the code from the Windows server itself and the error was apparent - it's trying to confirm the action:
PS C:\Program Files\netapp\wfa\posh> rename-ncnode -name primary_controller-01 -NewName test Rename node Are you sure you want to rename node primary_controller-01 to test? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): PS C:\Program Files\netapp\wfa\p osh> PS C:\Program Files\netapp\wfa\posh>
So I ended up adding '-Confirm:$false' to the command code and things work properly now.
Here's the PoSH code for the node rename if anyone needs it. Super simple but might save someone a few minutes of work.
param ( [parameter(Mandatory=$true, HelpMessage="Cluster IP Address")] [string]$Cluster, [parameter(Mandatory=$true, HelpMessage="Old Node name")] [string]$OldNodeName, [parameter(Mandatory=$true, HelpMessage="New Node name")] [string]$NewNodeName ) # connect to controller Connect-WfaCluster $Cluster # rename the aggregate Get-WFALogger -Info -message $("Renaming node '" + $OldNodeName + "' with new name of '" + $NewNodeName + "' on Cluster '" + $Cluster + "'") Rename-NcNode -Name $OldNodeName -NewName $NewNodeName -Confirm:$false -ErrorAction Stop