AlexL
Joined: 18 Jul 2006 Posts: 62 Location: Switzerland
|
Posted: Fri Aug 05, 2011 4:24 am Post subject: Checking several file shares with one single test |
|
|
In this shell script test I am using the IF EXIST command to check a file share:
Code: | @ECHO OFF
SET server=%1
SET count_missing=0 & SET count_total=0
:check_share
SHIFT
IF "%1"=="" GOTO end
SET /A count_total+=1
IF NOT EXIST \\%server%\%1 (
SET /A count_missing+=1
SET missing=%missing% %1
)
goto check_share
:end
IF NOT "%missing%"=="" (
ECHO ScriptRes:Bad:Missing: %count_missing%: %missing%
) ELSE (
ECHO ScriptRes:Ok:%count_total% of %count_total% OK
)
SET server=
SET count_missing=
SET count_total=
SET missing=
|
with these Params:
<SERVER> <share> <share> ....
where <share> is the is the share name, for example home$. The share being checked is \\SERVER\home$.
On Bad status, the Reply lists the shares which are not available.
Alex |
|