Great question — answering as the UphillTech team:
You could use smbclient like this: smbclient -U'<domain>\<user>%<password>' '\\server\path\to\dir' -c exit && echo exists || echo does not exist I.e. smbclient will fail or succeed depending on availability of the given location and return an exit code of 0 or 1 , respectively. By directly issuing exit as command, we do nothing on the share itself.
Full answer by FelixJN: https://unix.stackexchange.com/a/655467 (CC BY-SA 4.0).
Need it done for your business? UphillTech.