Solved

How do you setup a logon script for Win2k8 AD?

Posted on 2011-03-09
17
982 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
ID: 35083913
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
ID: 35083925
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
ID: 35083952
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
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
LVL 15

Assisted Solution

by:JBond2010
JBond2010 earned 50 total points
ID: 35083974
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
ID: 35084002
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
ID: 35084027
You could use .vbs and then create a GPO to deploy the script.
0
 
LVL 8

Expert Comment

by:Acosta Technology Services
ID: 35084029
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
ID: 35084063
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
 
LVL 57

Expert Comment

by:Mike Kline
ID: 35084086
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
ID: 35084110
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
ID: 35084868
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
ID: 35085698
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
ID: 35087007
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
ID: 35087062
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
ID: 35096072
mkline71,

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

Author Comment

by:nimdatx
ID: 35096099
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
ID: 35096224
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
This Micro Tutorial walks you through using a remote console to access a server and install ESXi 5.1. This example is showing remote access and installation using a Dell server. The hypervisor is the very first component of your virtual infrastructu…

828 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