Set objArgs = Wscript.Arguments if objArgs.Count = 0 then Wscript.Echo "sAMAccountName argument required. ""Jerry"" or ""*"" or ""J*"" or etc.." WScript.Quit (1) End If sam = objArgs(0) Set oShell = CreateObject( "WScript.Shell" ) domain =oShell.ExpandEnvironmentStrings("%USERDOMAIN%") Set objConnection = CreateObject("ADODB.Connection") Set objCommand = CreateObject("ADODB.Command") objConnection.Provider = "ADsDSOOBject" objConnection.Open "Active Directory Provider" Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject") Set OutPutFile = FileSystem.CreateTextFile("username.txt", True) Set objCommand.ActiveConnection = objConnection Set objRootDSE = GetObject("LDAP://RootDSE") 'Get domain strDNSDomain = objRootDSE.Get("defaultNamingContext") strBase = "<LDAP://" & strDNSDomain & ">" 'Define the filter elements strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" & sam & "))" 'List all attributes you will require strAttributes = "sAMAccountName,distinguishedName,name" 'compose query strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree" objCommand.CommandText = strQuery objCommand.Properties("Page Size") = 99999 objCommand.Properties("Timeout") = 300 objCommand.Properties("Cache Results") = False Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Do Until objRecordSet.EOF strSA = objRecordSet.Fields("sAMAccountName") strDN = objRecordSet.Fields("distinguishedName") strUserName = objRecordSet.Fields("name") strDomainUser = domain & "/" & strSA Set objUser = GetObject("WinNT://" & strDomainUser ) Desc = objUser.Description ' Wscript.Echo """" & strDN & """" ' Wscript.Echo """" & strSA & """;""" & strUserName & """;""" & strDN & """;""" & Desc & """" ' Now write that string to a file which is created ' within the EDATEMP folder and is therefore temporary OutPutFile.WriteLine """" & strSA & """;""" & strUserName & """;""" & strDN & """;""" & Desc & """" ' OutPutFile.WriteLine strSA & " ; " & strUserName objRecordSet.MoveNext Loop ' Clean up. objConnection.Close Set objConnection = Nothing Set objCommand = Nothing Set objRootDSE = Nothing Set objRecordSet = Nothing
getUserd.vbs smith*
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |
quote:Originally posted by dhagen:
For the record, WF 7.1.1 and up has LDAP as a data adaptor. You can now query your LDAP environment with the TABLE command.
quote:Originally posted by db:
Joan,would you mind sharing the steps to configure or set that up. I need to pull some info from our corporate database to create variables.
Thanks
quote:Originally posted by TexasStingray:
Joan,
What about the WebFOCUS LDAP Adapter. I think that might help.