[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

Map drives upon logon...

Objective:
Automatically map specific network drives to all domain users.  What's the best way of doing this?  Right now the organization is using a login.kix script but it seems to be a bit buggy.  Thanks.
0
sknoll84
Asked:
sknoll84
  • 6
  • 3
  • 2
  • +3
1 Solution
 
andeporterCommented:
A batch or java file would get the job done nicely.

net use k: /delete
net use l: /delete
net use u: /delete

net use l: \\server\share
net use k: \\server\share
net use u: \\server\%username%$

something like this.
0
 
Mike KlineCommented:
What you are doing (mapping using a script) is probably still the most common way.  You can use batch files, vbscript, kix, etc.
For long term I'd think about moving to use group policy preferences and not having to depend on login scripts
Group policy MVP Darren has a good overview of GPP here:
http://www.gpoguy.com/FAQs/Whitepapers/tabid/63/articleType/ArticleView/articleId/7/Group-Policy-Preferences-Overview-Whitepaper.aspx
Thanks
Mike
0
 
jaredwhamiltonCommented:
Yes, andeporter is correct, that is how i would do it as well. Just in case you need to full steps:

Start > Run > type gpedit.msc and click okay.

go to user configuration, windows settings, scripts logon/logoff

click on logon.

click add.. then show files. Create your bat file here, and save it. then, add it to the login scripts windows, and hit okay to exit the window.

Now, click start > Run > type cmd and hit okay

type gpupdate /force to update the group policy, and test it on your clients.

If all mapped drives are being created through a login script, make the bat file look like this:
net use * /delete /yes
net use g: \\servername\share
net use h: \\servername\share

Open in new window

0
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
sknoll84Author Commented:
does net use * /delete /yes simply delete all current mapped drives?
0
 
Mike KlineCommented:
does net use * /delete /yes simply delete all current mapped drives?
Yes, that is right.
Thanks
Mike
0
 
sknoll84Author Commented:
okay, let's get crazy.
can i define mapped drives per user group?
for example:
members of the accounting security group get h:\accounting
members of the developers security group get g:\projects
everyone gets j:\applications & i:\printers
0
 
zelron22Commented:
To do it by group you either have to set up different scripts/policies, use something like Kixtart, or you could use someting like IFMEMBER.EXE which can be called from a batch file so you can have one script for everyone.
@echo off
 
rem ** This is the Company Microsoft Windows 2000 Logon script.  
rem ** We are using the 'ifmember.exe' admin tool to map drives based
rem ** on security groups.  
 
ifmember "_company"
if not errorlevel 1 goto quit
net use m: \\server\company /persistent:no
:quit
 
ifmember "_Legal"
if not errorlevel 1 goto quit
net use j: \\server\Legal /persistent:no
:quit
 
ifmember "_Legal Library"
if not errorlevel 1 goto quit
net use j: \\server\Legal /persistent:no
:quit

Open in new window

0
 
Mike KlineCommented:
Yes,
Since you are already using kix here is an example using kix
http://www.experts-exchange.com/Programming/Misc/Q_21955480.html
This is where GPP will make things very easy with item level targeting.
Thanks
Mike
 
0
 
jaredwhamiltonCommented:
These will work, i usually make seperate scripts and policies and apply them to different OU's in Active Directory.
0
 
AmericomCommented:
We have moved away from kix for years and have been using ADSI. We only have one simple VBS script and launch by GPO. But regardless what you use, you may want to consider move away from drive mappings. This is another accomplishment we have made for many years since Windows 2000. Why use drive mappings? It's meaningless. of course, if you have some legacy application required a drive mapping, then you can always make an exception. Otherwise, most drive mappings are for group share and home shares etc. It should be meaningful. What we do is do them all in shortcuts with meaningful name such as "Human Resource" instead of "H:". For some users H: could be Home drive or something else, quite confusing. Afterall, what if you have 20+ mappings, what drive letter are you going to call them? That also slow down logon as it attempt to connect to the server for each drive mapping. Then later when you move server data around due to retirement or replacement of server etc, you need to always update your script. With shorcut, you only update shortcut. You can certainly assing shortcut(s) to specific group in the domain, much more direct and simpler to manage than those drive mappings...
0
 
sknoll84Author Commented:
Here is my current Kix logon.bat:

I want to delete all mapped drives before this script takes hold.
What's the correct command?
IF INGROUP("ATX\Acme-PA") = 1
	$HOMEDIR = "\\svr-fp01\" + @USERID + "$"
ELSE
	$HOMEDIR = "\\svr-fp01\" + @USERID + "$"
ENDIF
 
USE P: $HOMEDIR
USE G: "\\svr-fs01\APPS"
USE S: "\\svr-fp01\Corporate General"
USE V: "\\svr-fp01\G2 Portal"
 
 
; ***** Map Drives for Department mappings *****
 
IF INGROUP("Acme\HR") = 1
	USE F: "\\svr-fp01\HR"
ENDIF
 
IF INGROUP("Acme\PPM") = 1
	USE H: "\\svr-fp01\Common"
ENDIF
 
IF INGROUP("Acme\Exec") = 1
	USE I: "\\svr-fp01\Exec"
ENDIF
 
IF INGROUP("Acme\IT") = 1    
	USE I: "\\svr-fp01\IT"
ENDIF
 
IF INGROUP("Acme\Legal") = 1
	USE J: "\\svr-fp01\Legal"
 
EXIT

Open in new window

0
 
AmericomCommented:
If you want to keep the same format, you would just put "/DELETE after each "USE" line.
For example, USE I: /DELETE

Or just use this to blow off all drive mappings
USE "*"/DELETE
0
 
sknoll84Author Commented:
I used USE "*"/DELETE and it only Disconnected the network drive.

See screen shot,   I want these additional drives to drop off the face of the earth.
2-18-2009-11-57-39-PM.png
0
 
sknoll84Author Commented:
bump to the above post.
want the drive removed, not just disconnected
0
 
zelron22Commented:
Net use x: /delete should delete the drive, not just disconnect it.

If it isn't deleting it, put a pause command at the end of the script or direct the output of the script to a .txt file so you can see what's happening and why it isn't being deleted.
0
 
sknoll84Author Commented:
Put a pause command at the end of the entire kix script or what?
could you please define a little better please?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
  • 3
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now