KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Checking several file shares with one single test

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Library
View previous topic :: View next topic  
Author Message
AlexL



Joined: 18 Jul 2006
Posts: 62
Location: Switzerland

PostPosted: Fri Aug 05, 2011 4:24 am    Post subject: Checking several file shares with one single test Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index