Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > Windows Server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-30-2008, 04:21 PM
Microsoft Newbie
 
Posts: n/a
Login Scripts - Win2k DC

Hi

I am running a Windows 2000 Domain Controller and have my users organised
into Organisational Units in Active Directory. Could someone assist me with
creating a login script that maps network drives to the differing OUs.

Thanks


Reply With Quote
  #2 (permalink)  
Old 04-30-2008, 06:03 PM
kj [SBS MVP]
 
Posts: n/a
Re: Login Scripts - Win2k DC

Microsoft Newbie wrote:
> Hi
>
> I am running a Windows 2000 Domain Controller and have my users
> organised into Organisational Units in Active Directory. Could
> someone assist me with creating a login script that maps network
> drives to the differing OUs.
> Thanks


Time to learn a little scripting. Fortunatly the scriptcenter guys (and
gals) have made it easy for us

http://support.microsoft.com/kb/243215

Should have everything you need int he repository.

There is also a newgroup specifically for scripting help

microsoft.public.windows.server.scripting

Patient and quality scripters hang out there

--
/kj


Reply With Quote
  #3 (permalink)  
Old 04-30-2008, 06:14 PM
Richard Mueller [MVP]
 
Posts: n/a
Re: Login Scripts - Win2k DC


"Microsoft Newbie" <test@test.com> wrote in message
news:%23bBDUXtqIHA.3568@TK2MSFTNGP04.phx.gbl...
> Hi
>
> I am running a Windows 2000 Domain Controller and have my users organised
> into Organisational Units in Active Directory. Could someone assist me
> with creating a login script that maps network drives to the differing
> OUs.
>
> Thanks


I think you mean that you want to map a different share depending on the OU
the user object resides in. For example, everyone in ou=West will get drive
K: mapped to \\Server\ShareA, while everyone in ou=East will be K: mapped to
\\Server\ShareB. You can accomplish this by having one Group Policy applied
to ou=West and another applied to ou=East. There would be no need in the
script to check which OU the user object resides in. Simply map the correct
share. For example, the logon script applied to ou=West might be similar to:
==========
Option Explicit
Dim objNetwork

Set objNetwork = CreateObject("Wscript.Network")

' Trap error if drive already mapped.
On Error Resume Next
objNetwork.MapNetworkDrive "K:", "\\Server\ShareA"
If (Err.Number <> 0) Then
' Error raised, attempt to remove existing drive mapping.
objNetwork.RemoveNetworkDrive "K:", True, True
' Make another attempt to map the drive.
objNetwork.MapNetworkDrive "K:", "\\Server\ShareA"
(If Err.Number <> 0) Then
' Alert the user that K: cannot be mapped.
Call MsgBox("Unable to map drive K:")
End If
End If
On Error GoTo 0
========
If you want one Group Policy for the domain and one logon script, then the
script will need to check the OU. However, that is not simple. The most
reliable method is to bind to the user object and use the Parent method to
retrieve the AdsPath of the parent container/OU. You would check for the
AdsPath of the OU. Just checking the Relative Distinguished Name of the OU
(the "name" of the OU) can be flawed, as it may not uniquely identify the
OU. For example:
=============
Option Explicit
Dim objSysInfo, strUserDN, objUser, strParent
Dim objNetwork

Set objNetwork = CreateObject("Wscript.Network")

' Bind to user object.
Set objSysInfo = CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUserDN)

' Retrieve AdsPath of parent container/OU.
strParent = objUser.Parent

' Check for OU, using full AdsPath of the OU.
If (strParent = "LDAP://ou=West,ou=Sales,dc=MyDomain,dc=com") Then
' Trap error if drive already mapped.
On Error Resume Next
objNetwork.MapNetworkDrive "K:", "\\Server\ShareA"
If (Err.Number <> 0) Then
' Error raised, attempt to remove existing drive mapping.
objNetwork.RemoveNetworkDrive "K:", True, True
' Make another attempt to map the drive.
objNetwork.MapNetworkDrive "K:", "\\Server\ShareA"
(If Err.Number <> 0) Then
' Alert the user that K: cannot be mapped.
Call MsgBox("Unable to map drive K:")
End If
End If
On Error GoTo 0
End If
============
You could have a separate If/Then/End If structure for each OU, or use a
Select Case. For assistance configuring the logon script, see this link:

http://www.rlmueller.net/LogonScriptFAQ.htm

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > Windows Server


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:14 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Mortgages | Mortgages | MPAA | Loans | Shares



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114