We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Map drives upon logon...

Medium Priority
690 Views
Last Modified: 2012-05-06
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.
Comment
Watch Question

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.
CERTIFIED EXPERT
Top Expert 2013

Commented:
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
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

Author

Commented:
does net use * /delete /yes simply delete all current mapped drives?
CERTIFIED EXPERT
Top Expert 2013

Commented:
does net use * /delete /yes simply delete all current mapped drives?
Yes, that is right.
Thanks
Mike

Author

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

Commented:
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

CERTIFIED EXPERT
Top Expert 2013
Commented:
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
 

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
These will work, i usually make seperate scripts and policies and apply them to different OU's in Active Directory.

Commented:
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...

Author

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

Commented:
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

Author

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

Author

Commented:
bump to the above post.
want the drive removed, not just disconnected

Commented:
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.

Author

Commented:
Put a pause command at the end of the entire kix script or what?
could you please define a little better please?
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.