I'm using the cmdlet Invoke-NaSsh to issue ontap commands that don't have an API call. In this case I want to apply fsecurity configs to a volume. So far I was not able to get the warning or error message that is displayed in the powershell console into a variable. I'd like to check if the command throwed an error. Any help is highly appreciated. I attach the scrit and the console output. Thanks in advance.
$napasswd = "p@assw0rd" # Password for the Hosting-Filer, the VFiler and the AD Administrator User
$nahost = "g100bpmc002.g100.intern" # Name of the Hosting Filer
$navfiler = "v998spnvv1999gl" # Name of the VFiler (also the NetBIOS Name of the VFiler)