General discussion

Locked

Logon Script problems

By JuanDeMarco ·
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 conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Logon Script problems

by tduval In reply to Logon Script problems

No need to use vbscript to find if member of any group, there a utility in the ressource kit, called : ifmember.exe to test this.

Just need to make a NET USE x: \\server\shared forlder, after.

Collapse -

Logon Script problems

by JuanDeMarco In reply to Logon Script problems

I am tring to unify my logon script to VB and take out any outside programs or commands. I know that there are many diffrent ways to do this (I'm currently using Kix for this function), but I wish to do it with VB only.

Collapse -

by wroming In reply to Logon Script problems

There is even an easier way to do it as well, just go into AD and to each user you are wanting to have a path to a certain place. Go to the properties of the user and select the TAB profile and there there is a place for home directory put it here and it will make a drive on the end users computer everytime.

Collapse -

by JuanDeMarco In reply to

That would be nice, if I was just mapping the home dirs. But I'm mapping more than that. And I can use the OU's as I can't get that cleared through the upper management. Nice try...

Collapse -

by JuanDeMarco In reply to Logon Script problems

This question was closed by the author

Back to Networks Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums