Ask Your Question
1

Can you describe an Active Directory login script that includes a condition?

asked 2023-06-15 10:51:43 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-15 11:04:02 +0000

ladyg gravatar image

Sure, here's an example of an Active Directory login script with a condition:

Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)

If (objUser.Department = "Sales") Then
    MapNetworkDrive "S:", "\\Server\Sales"
ElseIf (objUser.Department = "Marketing") Then
    MapNetworkDrive "S:", "\\Server\Marketing"
End If

In this script, we first retrieve information about the user who is logging in using the ADSystemInfo and GetObject functions. We then use an If statement to check the user's department. If the user is in the Sales department, we map the S: drive to the Sales network share. If the user is in the Marketing department, we map the S: drive to the Marketing network share.

This is just an example, and you could use any condition you like to determine which network drives to map or other actions to take during login.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-15 10:51:43 +0000

Seen: 17 times

Last updated: Jun 15 '23