Petri IT Knowledgebase Forums
 

Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > DOS Command Shell
Petri.co.il is happy to award auglan the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read

Notices

Map Drive Network

Map Drive Network

this thread has 6 replies and has been viewed 930 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 6th September 2012, 06:22
momaydopod momaydopod is offline
Casual
Casual
 
 Join Date: Jul 2011
  6 month star 12 month star
 Posts: 50
 Reputation: momaydopod is on a distinguished road (10)
Thumbs up Map Drive Network

Hi All

I create Bat file but i need to check permission via user if user don't access to folder no display Drive if user have permission to access to folder can display.

How to edit

Quote:
@echo off
net use s: /delete /yes
net use s: \\172.16.80.4\Public$
net use p: /delete /yes
net use p: \\172.16.80.4\PM /persistent:yes
net use i: /delete /yes
net use i: \\172.16.80.4\System_Support /persistent:yes
  #2  
Old 6th September 2012, 09:37
AndyJG247's Avatar
AndyJG247 AndyJG247 is offline
Senior Member
Wrote the book
 
 Join Date: Mar 2008
  6 month star 12 month star
 Location: London
 Posts: 3,842
 Reputation: AndyJG247 is a jewel in the roughAndyJG247 is a jewel in the roughAndyJG247 is a jewel in the roughAndyJG247 is a jewel in the rough (349)
Default Re: Map Drive Network

Can't think how to do it in a batch file but a slightly different way would be with KIXtart like this:
IF INGROUP ("USERGROUP1")
USE U: \\servername.\domain.local\share

or you could use group policy which applies based on group membership.
__________________
cheers
Andy

Please read this before you post:
http://support.microsoft.com/kb/555375

Quis custodiet ipsos custodes?
  #3  
Old 6th September 2012, 09:43
momaydopod momaydopod is offline
Casual
Casual
 
 Join Date: Jul 2011
  6 month star 12 month star
 Posts: 50
 Reputation: momaydopod is on a distinguished road (10)
Thumbs up Re: Map Drive Network

Quote:
Originally Posted by AndyJG247 View Post
Can't think how to do it in a batch file but a slightly different way would be with KIXtart like this:
IF INGROUP ("USERGROUP1")
USE U: \\servername.\domain.local\share

or you could use group policy which applies based on group membership.
I don't have permission on DC
  #4  
Old 6th September 2012, 09:52
Ossian Ossian is offline
Administrator
 
 Join Date: Nov 2003
  6 month star 12 month star
 Location: Bonnie Scotland
 Posts: 15,134
  Send a message via Skype™ to Ossian
 Reputation: Ossian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud of (1300)
Default Re: Map Drive Network

Why bother?
If users do not have permission, they may see the drive but won't get into it

(or ask your network admin to set things up on the domain for you)
__________________
Tom Jones
MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
PhD, MSc, FIAP, MIITT
IT Trainer / Consultant
Ossian Ltd
Scotland

** Remember to give credit where credit is due and leave reputation points where appropriate **
  #5  
Old 6th September 2012, 21:05
Rems's Avatar
Rems Rems is offline
Moderator
 
 Join Date: Mar 2005
  6 month star 12 month star
 Location: NL
 Posts: 2,267
 Reputation: Rems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to behold (903)
Default Re: Map Drive Network

try this:
Code:
@echo off

:: Disconnect drives
for %%$ in (s: p: i:) do net.exe use %%$ /D /Y

:: Map drives only if user has at least Read permissions there
call:MapDrv s: "\\172.16.80.4\Public$" /P:N
call:MapDrv p: "\\172.16.80.4\PM" /P:N
call:MapDrv i: "\\172.16.80.4\System_Support" /P:N

echo done....


:end of batch
GOTO:EOF ---- Map drive routine ----
   :MapDrv
   if exist "%~2\*" (net.exe use %*)
exit /b 0
/Rems
__________________

This posting is provided "AS IS" with no warranties, and confers no rights.

__________________

** Remember to give credit where credit's due **
and leave Reputation Points for meaningful posts
  #6  
Old 7th September 2012, 05:18
momaydopod momaydopod is offline
Casual
Casual
 
 Join Date: Jul 2011
  6 month star 12 month star
 Posts: 50
 Reputation: momaydopod is on a distinguished road (10)
Lightbulb Re: Map Drive Network

what is the net.exe


Quote:
Originally Posted by Rems View Post
try this:
Code:
@echo off
 
:: Disconnect drives
for %%$ in (s: p: i:) do net.exe use %%$ /D /Y
 
:: Map drives only if user has at least Read permissions there
call:MapDrv s: "\\172.16.80.4\Public$" /P:N
call:MapDrv p: "\\172.16.80.4\PM" /P:N
call:MapDrv i: "\\172.16.80.4\System_Support" /P:N
 
echo done....
 
 
:end of batch
GOTO:EOF ---- Map drive routine ----
   :MapDrv
   if exist "%~2\*" (net.exe use %*)
exit /b 0
/Rems
  #7  
Old 7th September 2012, 09:52
Ossian Ossian is offline
Administrator
 
 Join Date: Nov 2003
  6 month star 12 month star
 Location: Bonnie Scotland
 Posts: 15,134
  Send a message via Skype™ to Ossian
 Reputation: Ossian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud ofOssian has much to be proud of (1300)
Default Re: Map Drive Network

Quote:
Originally Posted by momaydopod View Post
what is the net.exe
There is a very helpful, but apparently unknown, web site called
You type in a question and it gives you a list of sites which can answer it.

In your case (using exactly what you posted) there are 23 million results that took approximately 10 seconds to find.
Here, I've saved you those 10 seconds of your life

http://www.google.co.uk/#hl=en&sclie...w=1489&bih=799
__________________
Tom Jones
MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
PhD, MSc, FIAP, MIITT
IT Trainer / Consultant
Ossian Ltd
Scotland

** Remember to give credit where credit is due and leave reputation points where appropriate **
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB drive mapping as network drive for domain users rajeevsharma Windows Server 2000 / 2003 6 11th October 2009 11:02
Network Drive pbedorf Windows Server 2000 / 2003 1 5th June 2007 19:44
Network Drive Dragonslayer Windows Server 2000 / 2003 9 1st May 2007 21:36
Help in creating mapped network drive (was:Network Drive) Qman46 Windows Server 2000 / 2003 4 4th September 2006 20:12
Map network drive - GPO pardal51 GPO 3 6th September 2005 12:59


All times are GMT +3. The time now is 08:24.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri