Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Retrieving Security Group and Username from a VPN Connection

Reply
 
Old 02-04-2009   #1 (permalink)
jimmysjams


 
 

Retrieving Security Group and Username from a VPN Connection

I'm trying to map network drives according to username and security
group over a VPN. I've put together a script that will map drives if
the computer is part of the domain, but it doesn't work for obvious
reasons on computers connected over a VPN. Is there a way to retrieve
an user's Active Directory information from a VPN connection using
Cisco Systems VPN Client Version 5.0.02.0090?

I've gone through page after page and I still haven't found the exact
solution. Any help will be greatly appreciated, thanks in advance.

My System SpecsSystem Spec
Old 02-10-2009   #2 (permalink)
jimmysjams


 
 

Re: Retrieving Security Group and Username from a VPN Connection

On Feb 4, 1:16*pm, jimmysjams <jimmysj...@xxxxxx> wrote:
Quote:

> I'm trying to map network drives according to username and security
> group over a VPN. *I've put together a script that will map drives if
> the computer is part of the domain, but it doesn't work for obvious
> reasons on computers connected over a VPN. *Is there a way to retrieve
> an user's Active Directory information from a VPN connection using
> Cisco Systems VPN Client Version 5.0.02.0090?
>
> I've gone through page after page and I still haven't found the exact
> solution. *Any help will be greatly appreciated, thanks in advance.
you have to log into the vpn in a different segment of the code.
logging in is easy compared to the rest of the tasks.

Sub MapDrivesForUser(userName, password)
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1

Dim objUser
Dim dictionaryGroups
Dim objFSO
Dim strDomain
Dim objTrans

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTrans = CreateObject("NameTranslate")
Set objNetwork = CreateObject("WScript.Network")

strDomain = "DOMAIN"
strNTName = strDomain & "\" & userName

objTrans.InitEx ADS_NAME_INITTYPE_GC, "", userName, strDomain,
password
objTrans.Set ADS_NAME_TYPE_NT4, strNTName

strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)

strUserDN = Replace(strUserDN, "/", "\/")
Set objDSObj = GetObject("LDAP:")
Set objUser = objDSObj.OpenDSObject("LDAP://domain.com/" &
strUserDN, strNTName, strPassword, ADS_SECURE_AUTHENTICATION or
ADS_SERVER_BIND)

Set dictionaryGroups = BuildDriveDictionary(userName)

On Error Resume Next
For Each oGroup in objUser.Groups
groupName = UCase(Right(oGroup.Name,Len(oGroup.Name)-3))
If dictionaryGroups.Exists(groupName) Then
Set dictItem = dictionaryGroups.Item(groupName)
For Each key in dictItem.Keys
If objFSO.DriveExists(key) Then
objNetwork.RemoveNetworkDrive(key)
End If
objNetwork.MapNetworkDrive key, dictItem.Item(key)
Next
End If
Next
End Sub
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
how do i check for Security Group vs Distribution Group ? PowerShell
add user to group /group scope - Global /Group type - Security PowerShell
Get username/group membership from another forest? VB Script
Group By Type - The [username] Folder Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46