Solved

How do you setup a logon script for Win2k8 AD?

Posted on 2011-03-09
17
953 Views
Last Modified: 2012-05-11
Hello,

I've setup a new DC and Fileserver with an existing Fileserver. I will copy over all data with Robocopy from old Fileserver to my new Fileserver. I'm interested in finding out how to properly map a new network drive pointing to my new share directory folders on my users desktops. I've done some research and found some information, however I want to ensure I'm doing it correctly within a Win2k8 server.

Thanks,

nimdatx
0
Comment
Question by:nimdatx
  • 5
  • 4
  • 4
  • +3
17 Comments
 
LVL 8

Expert Comment

by:Acosta Technology Services
Comment Utility
Create a batch file .bat in the sysvol directory of the domain controller that contains the new mappings.  In Active Directory adjust the field under the profile tab for the users to utilize the new batch file (just put the file name, not the full path).  When each user logs in it will run that batch file and map the drives.
0
 
LVL 8

Accepted Solution

by:
Acosta Technology Services earned 200 total points
Comment Utility
Here's a good reference for scripts and commands:

http://www.computerperformance.co.uk/Logon/logon_scripts.htm
0
 
LVL 57

Expert Comment

by:Mike Kline
Comment Utility
One nice thing is that you can also use group policy preferences to map drives

http://blogs.technet.com/b/grouppolicy/archive/2009/02/11/gp-preferences-will-reduce-logon-scripts-mapping-drives.aspx

GPP can help reduce or even eliminate all login scripts

Thanks

Mike
0
 
LVL 15

Assisted Solution

by:JBond2010
JBond2010 earned 50 total points
Comment Utility
First of all you create the batch file using a text editor. Open notepad and then type for example:

net use x: \\share_name\folder_name

Save the file .bat and in the location of the netlogon folder.
0
 
LVL 1

Author Comment

by:nimdatx
Comment Utility
Can I use a .vbs extension? Also what if the users drive letter is taking up and my script says to use a specific letter? Is there a way to force to use first availible?
0
 
LVL 15

Expert Comment

by:JBond2010
Comment Utility
You could use .vbs and then create a GPO to deploy the script.
0
 
LVL 8

Expert Comment

by:Acosta Technology Services
Comment Utility
I would use a batch file that calls the .vbs script.  I don't know of a way to force first available.  I often set each map drive to use the "del" command first to make sure we have the same map drives across the company.  For the user share drive I would recommend setting that up through the profile tab in AD, rather than the login script.
0
 
LVL 1

Author Comment

by:nimdatx
Comment Utility
Can I use this script within notepad and save as a batch file? My server is 192.168.1.173 and share name is Renal Common.

' Map network drive script
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "S:" , "\\192.168.1.173\Renal Common"
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 57

Expert Comment

by:Mike Kline
Comment Utility
You can setup a vbscript and I can add that zone if you want to go that route.  I you are newer to vbscript or scripting I'd definitely consider using/testing GPP for mappings.

Thanks

Mike
0
 
LVL 8

Expert Comment

by:Acosta Technology Services
Comment Utility
Might just be easier to use the "NET USE" command for a .bat file.

From Microsoft:

To assign the disk-drive device name E: to the Letters shared directory on the \\Financial server, type:
net use e: \\financial\letters

To assign (map) the disk-drive device name M: to the directory Mike within the Letters volume on the \\Financial NetWare server, type:
net use m: \\financial\letters\mike

To connect the user identifier Dan as if the connection were made from the Accounts domain, type:
net use d:\\server\share /user:Accounts\Dan

To disconnect from the \\Financial\Public directory, type:
net use f: \\financial\public /delete

To connect to the resource memos shared on the \\Financial 2 server, type:
net use k: "\\financial 2" \memos

To restore the current connections at each logon, regardless of future changes, type:
net use /persistent:yes
0
 
LVL 5

Expert Comment

by:chkdsk01
Comment Utility
I use a vbscript as a login script.  Here is an example of some lines in my script.

If you want to use a batch file, use the net use command instead.
'============================================
'Removes any existing network drives
'============================================
WSHNetwork.RemoveNetworkDrive "G:"
WSHNetwork.RemoveNetworkDrive "I:"
WSHNetwork.RemoveNetworkDrive "J:"
WSHNetwork.RemoveNetworkDrive "O:"
WSHNetwork.RemoveNetworkDrive "P:"
WSHNetwork.RemoveNetworkDrive "Q:"
WSHNetwork.RemoveNetworkDrive "S:"
WSHNetwork.RemoveNetworkDrive "T:"
WSHNetwork.RemoveNetworkDrive "U:"
WSHNetwork.RemoveNetworkDrive "V:"
WSHNetwork.RemoveNetworkDrive "W:"
WSHNetwork.RemoveNetworkDrive "X:"
WSHNetwork.RemoveNetworkDrive "Y:"
WSHNetwork.RemoveNetworkDrive "Z:"

'============================================
' If Logic Testing for single user based mapped drives
'============================================
If WshNetwork.UserName = "bev" Then
objNetwork.MapNetworkDrive "J:", "\\10.90.10.91\busadm"
End If

'===================================================================
' If logic testing strGroup for the values in Const groups
'===================================================================
If InStr(strGroup, lcase(transportation)) Then
'WScript.Echo "Transportation"							'REM this out when not testing
objNetwork.MapNetworkDrive "T:", "\\transportation\transport"
End If

'===============
'Quit the Script
'=============== 
 wscript.quit

Open in new window

0
 
LVL 95

Expert Comment

by:Lee W, MVP
Comment Utility
You can easily force the first available drive letter using an asterisk,
net use * \\server\share

HOWEVER, I would advise against this.  If you start forcing the next available drive letter, you start confusing people and making it difficult on your technicians to support your users.  When users know the Departmental share is on G: (for example), then the support staff can say to reference G: and they know what the user is talking about when the user says there is a problem with the G: drive.  If you force the next availble letter, then some users may have it at G:, others at H:, others at I: and still others at J: or another letter... now Jane asks Joe, where is the report on sales, Joe says H:, but for jane it's J, now they are both confused.
0
 
LVL 1

Author Comment

by:nimdatx
Comment Utility
Ok so, I open up notepad and do a net use X:\\server\share and save as .bat on my desktop? How do I use AD to push this out?

mkline71,

How do I use GPP for mapping and is this more reliable then a logon script?

Thanks,

nimdatx
0
 
LVL 57

Assisted Solution

by:Mike Kline
Mike Kline earned 250 total points
Comment Utility
Take a look at the previous link for details screenshots  http://blogs.technet.com/b/grouppolicy/archive/2009/02/11/gp-preferences-will-reduce-logon-scripts-mapping-drives.aspx

If your clients are XP then you will need the client side extensions installed great overview of GPP here  http://www.gpoguy.com/Portals/0/Group%20Policy%20Preferences%20Overview.pdf

as far as reliability, if GP processing is working both a login script and GPP are going to be reliable.  What I'd say is that it is easier if you are not super familiar with vbscript or scripting.

Thanks

Mike
0
 
LVL 1

Author Comment

by:nimdatx
Comment Utility
mkline71,

Do I need to install anything on the user side (desktop)?
0
 
LVL 1

Author Comment

by:nimdatx
Comment Utility
One more thing....can I set home folder to new share (files users need) or is that for their own folder with their specific documents?
0
 
LVL 57

Assisted Solution

by:Mike Kline
Mike Kline earned 250 total points
Comment Utility
Take a look at that second link I sent, if you are using XP you will need the client side extensions, may have already been pushed (WSUS can do it)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This video shows you how to use a vSphere client to connect to your ESX host as the root user. Demonstrates the basic connection of bypassing certification set up. Demonstrates how to access the traditional view to begin managing your virtual mac…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now