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.
Asked: 2023-06-15 10:51:43 +0000
Seen: 18 times
Last updated: Jun 15 '23