Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Map all shared folder in a machine

Posted on 2007-10-04
5
Medium Priority
?
177 Views
Last Modified: 2010-04-16
Hi,

I want a way where i can specify the shared folder machine name and all the folders are mapped to the machine i am running the script.

Is there a way to do this.

Even set the username password and set as connect on restart.

Regards
Sharath
0
Comment
Question by:bsharath
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:bpmurray
ID: 20016650
Try a batch file with something like this. You use it by passing 3 parameters - the server name, your user name and the password:

if x%3==x goto :ERR
SET SERVER=%1
SET USERNAME=%2
SET PASSWORD=%3
for /F "skip=7 tokens=1,2" %%A in ('net view \\%SERVER%') do if %%B==Disk net use * \\%SERVER%\%%A %PASSWORD% /user:%USERNAME%
0
 
LVL 11

Author Comment

by:bsharath
ID: 20019485
I get this...
C:\>"map all folders.bat"

C:\>if x == x goto :ERR
The system cannot find the batch label specified - ERR
0
 
LVL 15

Accepted Solution

by:
bpmurray earned 2000 total points
ID: 20020401
Oops - incomplete ...

if x%3==x goto :ERR
SET SERVER=%1
SET USERNAME=%2
SET PASSWORD=%3
for /F "skip=7 tokens=1,2" %%A in ('net view \\%SERVER%') do if %%B==Disk net use * \\%SERVER%\%%A %PASSWORD% /user:%USERNAME%
goto :XIT
:Err
echo Usage: %0 ServerName UserName Password
echo where
echo       ServerName is the name of the machine you want to scan
echo       UserName    is the name of the user (who must haver the necessary permissions
echo       Password    is the user's password
:XIT
             
      10.05.2007 at 04:43AM IST, ID: 20019485
0
 
LVL 11

Author Comment

by:bsharath
ID: 20020439
I get this...

C:\>"map all folders.bat"

C:\>if x == x goto :ERR

C:\>echo Usage: "map all folders.bat" ServerName UserName Password
Usage: "map all folders.bat" ServerName UserName Password

C:\>echo where
where

C:\>echo       ServerName is the name of the machine you want to scan
      ServerName is the name of the machine you want to scan

C:\>echo       UserName    is the name of the user (who must haver the necessary
 permissions
      UserName    is the name of the user (who must haver the necessary permissi
ons

C:\>echo       Password    is the user's password
      Password    is the user's password
C:\>

No folders asre mapped...
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 20024803
Well READ the error message!!!!!!!!!!!!!!!!!!!!!!!!!!!

Call it like this:

             "map all folders.bat" myserver myusername mypassword
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question