Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Get-NaControllerError prints all zapi error codes. If I want to compare the error code in my script, how do I refer to the error code by name? For example, $ErrorNumber -eq $EONTAP_EPERM instead of $ErrorNumber -eq 1.
PS C:\Toolkit\1.7.0> Get-NaControllerError
Code Name Description
---- ---- -----------
1 EONTAPI_EPERM Operation not permitted
2 EONTAPI_ENOENT No such file or directory
3 EONTAPI_ESRCH No such process
4 EONTAPI_EINTR Interrupted system call
5 EONTAPI_EIO Input/Output error
Thanks,
neelesh
Not sure I understand the question, but the cmdlet does accept arguments such as the name (which could be a variable):
PS C:\> Get-NaControllerError -Name EONTAPI_EPERM
Code Name Description
---- ---- -----------
1 EONTAPI_EPERM Operation not permitted
PS C:\> Get-NaControllerError -Code 1
Code Name Description
---- ---- -----------
1 EONTAPI_EPERM Operation not permitted
Thanks for the reply. I am looking for a way to use EONTAPI_* inside my script. Currently I have:
# at the top
$E_JOB_EXISTS = 18380
# somewhere down in the script
if ($errorNumber -eq $E_JOB_EXISTS) | |
{ |
Is there a better way to do this using a builtin EONTAPI_JOB_EXISTS variable?
Thanks.
There aren't built-in variables for error codes, but you can do this:
if ($errorNumber -eq (Get-NaControllerError EONTAPI_EEXIST).Code) {...}
Ok. Thanks.