In a script, you can change the exit code using a keyword exit.
Normal completion will set the exit code to 0
Unmounted will THROWset the exit code to 1
The operator exitwill stop the process and set the exit code to everything that is indicated.
In your case, I did something like this
if ( $(hostname) -eq 'mycomputername')
{
exit 0
}
else
{
exit 1
}