Logon Script problems - TechRepublic
General discussion
May 1, 2003 at 10:17 PM
juandemarco

Logon Script problems

by juandemarco . Updated 22 years, 10 months ago

I’m trying to set up a logon script using VBScript that will map directories based on their group membership. Everything is based on the LDAP, however that requires that you know the LDAP path, and full name. Logon name is first initial last name,and I need a method to translate that to the LDAP path (or just to check group membership). I just can’t get this. Anyone have an idea?

Here is a script I’ve been playing with:

On Error Resume Next
strComputer = “DC”

Set objUserAccount =GetObject(“winmgmts:\\.\root \cimv2:Win32_UserAccount.Domain=’DomainName’,Name=’UserName’ “)

UserFullName = objUserAccount.FullName

Set objUser = GetObject (“LDAP://cn=” & UserFullName & “,cn=users,dc=hch_abq,dc=local”)

‘ MsgBox “Distinguished Name: ” & VbCrLf & objUser.Get(“distinguishedName”)

UserName = objUser.Get(“distinguishedName”)

objMemberOf = objUser.GetEx(“MemberOf”)
For Each Group in objMemberOf

If Group = “CN=GroupName,OU=Groups,DC=test,DC=com” Then
WshNetwork.MapNetworkDrive “G:”, “\\Server\GroupShare”
End If

End If

This discussion is locked

All Comments