Stefan, you can use PowerShell's error handling for that. See 'help about_commonparameters'.
For example, you can capture warnings like this:
PS C:\> Invoke-NaSsh asdf -WarningVariable warn
WARNING: asdf not found. Type '?' for a list of commands
PS C:\> $warn[0] | fl
Message : asdf not found. Type '?' for a list of commands
InvocationInfo : System.Management.Automation.InvocationInfo
PipelineIterationInfo : {0, 1}
If you want your script to stop execution if you get a warning, that's easy too:
PS C:\> Invoke-NaSsh asdf -WarningVariable warn -WarningAction stop
WARNING: asdf not found. Type '?' for a list of commands
Invoke-NaSsh : Command execution stopped because the preference variable "WarningPreference" or common parameter is set to Stop.
At line:1 char:13
+ invoke-nassh <<<< asdf -WarningVariable warn -WarningAction stop
+ CategoryInfo : OperationStopped: (:) [Invoke-NaSsh], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ActionPreferenceStop,DataONTAP.PowerShell.SDK.Cmdlets.Toolkit.Ssh.InvokeNaSsh