![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Get LDAP-"Path" from WinNT object Hello I Habe an Object, which represents the Current User: Set objUser = GetObject("WinNT://" & strNetBIOSDomain & "/" _ & strNTName & ",user") Whith this i can check if the user is in e specifict group. however, nested groups doesn't work like this. For nested Groups i've found a solution, but i need the LDAP-Path. Is there a way to easly get that? The objUser Object has some Attributes like .name or so but i dont find i documentation about this. Maybe there is .Path Proberty or so? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Get LDAP-"Path" from WinNT object Albert Andersson wrote: Quote: > > I Habe an Object, which represents the Current User: > > Set objUser = GetObject("WinNT://" & strNetBIOSDomain & "/" _ > & strNTName & ",user") > > Whith this i can check if the user is in e specifict group. however, > nested groups doesn't work like this. > > For nested Groups i've found a solution, but i need the LDAP-Path. Is > there a way to easly get that? > > The objUser Object has some Attributes like .name or so but i dont find i > documentation about this. Maybe there is .Path Proberty or so? can use the NameTranslate object to retrieve the Distinguished Name required for the LDAP provider. See this link for details: http://www.rlmueller.net/NameTranslateFAQ.htm From #6, the quick example in the above link: =========== ' Constants for the NameTranslate object. Const ADS_NAME_INITTYPE_GC = 3 Const ADS_NAME_TYPE_NT4 = 3 Const ADS_NAME_TYPE_1779 = 1 ' Specify the NetBIOS name of the domain and the NT name of the user. strNTName = strNetBIOSDomain& "\" & strNTName ' Use the NameTranslate object to convert the NT user name to the ' Distinguished Name required for the LDAP provider. Set objTrans = CreateObject("NameTranslate") ' Initialize NameTranslate by locating the Global Catalog. objTrans.Init ADS_NAME_INITTYPE_GC, "" ' Use the Set method to specify the NT format of the object name. objTrans.Set ADS_NAME_TYPE_NT4, strNTName ' Use the Get method to retrieve the RPC 1779 Distinguished Name. strUserDN = objTrans.Get(ADS_NAME_TYPE_1779) ' Bind to the user object in Active Directory with the LDAP provider. Set objUser = GetObject("LDAP://" & strUserDN) -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Get LDAP-"Path" from WinNT object Danke ich habe es damit hinbekkommen. Dieses Stück code werde ich nie mehr aus der Hand geben. Richard Mueller [MVP] schrieb: Quote: > Albert Andersson wrote: > Quote: >> I Habe an Object, which represents the Current User: >> >> Set objUser = GetObject("WinNT://" & strNetBIOSDomain & "/" _ >> & strNTName & ",user") >> >> Whith this i can check if the user is in e specifict group. however, >> nested groups doesn't work like this. >> >> For nested Groups i've found a solution, but i need the LDAP-Path. Is >> there a way to easly get that? >> >> The objUser Object has some Attributes like .name or so but i dont find i >> documentation about this. Maybe there is .Path Proberty or so? > If you have the NT Name of the user and the NetBIOS name of the domain you > can use the NameTranslate object to retrieve the Distinguished Name required > for the LDAP provider. See this link for details: > > http://www.rlmueller.net/NameTranslateFAQ.htm > > From #6, the quick example in the above link: > =========== > ' Constants for the NameTranslate object. > > Const ADS_NAME_INITTYPE_GC = 3 > Const ADS_NAME_TYPE_NT4 = 3 > Const ADS_NAME_TYPE_1779 = 1 > > ' Specify the NetBIOS name of the domain and the NT name of the user. > strNTName = strNetBIOSDomain& "\" & strNTName > > ' Use the NameTranslate object to convert the NT user name to the > ' Distinguished Name required for the LDAP provider. > Set objTrans = CreateObject("NameTranslate") > > ' Initialize NameTranslate by locating the Global Catalog. > objTrans.Init ADS_NAME_INITTYPE_GC, "" > ' Use the Set method to specify the NT format of the object name. > objTrans.Set ADS_NAME_TYPE_NT4, strNTName > > ' Use the Get method to retrieve the RPC 1779 Distinguished Name. > strUserDN = objTrans.Get(ADS_NAME_TYPE_1779) > > > > ' Bind to the user object in Active Directory with the LDAP provider. > Set objUser = GetObject("LDAP://" & strUserDN) > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Missing ?.NET? file in a C:\winnt\assembly "subdirectory" | .NET General | |||
| "Open command prompt here" and "Copy as path" | Vista performance & maintenance | |||
| Separate hashtable vs $alist | where-object { "key" = "value" } versus something else? | PowerShell | |||
| [VBScript](Set objUser = GetObject("WinNT://" & strComputer)) -eq [Powershell]? | PowerShell | |||
| False IE doc body error - "Object reference not set to an instance of an object" | PowerShell | |||