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.
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
Asked: 2023-06-15 10:51:43 +0000
Seen: 17 times
Last updated: Jun 15 '23
What modifications can be made to this condition in order to substitute infinite and NaN values?
What is the time complexity of this code when it includes a conditional statement?
How can we make the for loop pause until we receive a signal for the next item?
What is the condition to prevent the deletion of folders containing files?
What does it mean when the if block is not being executed?
In R, how can the difference between dates be computed with a given condition?
How can I apply OR condition between dimensions in Dynamics Row Level Security?