?
Solved

How do you setup a logon script for Win2k8 AD?

Posted on 2011-03-09
17
Medium Priority
?
1,006 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:Jaime Campos
  • 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 800 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
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.

 
LVL 15

Assisted Solution

by:JBond2010
JBond2010 earned 200 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:Jaime Campos
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:Jaime Campos
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 97

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:Jaime Campos
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 1000 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:Jaime Campos
ID: 35096072
mkline71,

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

Author Comment

by:Jaime Campos
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 1000 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

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.

Question has a verified solution.

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

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
A simple method to resolve a "keyboard not working" problem by modifying the Windows registry. This issue can often be encountered after using the VMware vCenter Converter Standalone Agent to perform a Physical-to-Virtual (P2V) conversion process.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. Theā€¦
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

621 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