WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

;From:  Crypt  
;Date:  Friday, February 07, 2003 04:14 PM  
;
;This is a modification to a previously published script. It will
;return all of the attributes that you can populate on an AD user
;account. You will still have to figure out what the field they
;display in or what they are exactly. Eventually I'll have a list
;of what they're associated with.
;
;1. Set the login name 
;2. Change the LDAP path to a valid one in your environment.
;
;------------------------------------
AddExtender("WWADS34I.DLL")

; Set credentials.
Account="ACCOUNT WITH ADMIN ACCESS"
pwd=AskPassword ("Password", "Enter the Password for %Account%")

a=dsSetCredent(Account, pwd)


; Define some constants.
MANDATORY = 1
OTIONAL = 2
MANANDOPT = 3

; An Active Directory example.

; The user object "Russ T Gate" on the "win2000" server.

; Make sure the following on one line
sAdsiPath = "LDAP://win2000/CN=Russ T Gate,CN=Users,DC=win2000,DC=windowware,DC=com"

Output=FileOpen("C:\temp\out.csv","WRITE")
FileWrite(Output,"Type,Property Name,Value")


; Get mandatory properties of object.
sList = dsGetPropName(sAdsiPath, MANDATORY)
If sList != ""
   count=ItemCount(sList,@TAB)
   For x=1 To count
      item=ItemExtract(x,sList,@TAB)
      val=dsGetProperty(sAdsiPath, item)
      FileWrite(Output,"MANDATORY,%item%,%val%")
   Next
EndIf 

; Get optional properties of object.
sList = dsGetPropName(sAdsiPath, OTIONAL)
If sList != ""
   count=ItemCount(sList,@TAB)
   For x=1 To count
      item=ItemExtract(x,sList,@TAB)
      val=dsGetProperty(sAdsiPath, item)
      Data=StrCat("OPTIONAL",",",item,",",val)
      FileWrite(Output,Data)
   Next
EndIf 


; Get all properties of object.
;sList = dsGetPropName(sAdsiPath, MANANDOPT )
;if sList != "" 
   ; sList = strreplace(sList,@TAB, @CRLF)
   ; message("All Property names. ", sList)
   ; FileWrite(Output," ")
   ;FileWrite(Output," ")
   ;FileWrite(Output,"All Property names. ")
   ;FileWrite(Output,"--------------------------")
   ;FileWrite(Output,sList)
;endif 

FileClose(Output)
Run("Excel.exe","C:\temp\out.csv") 


Article ID:   W15826
File Created: 2004:03:30:15:41:00
Last Updated: 2004:03:30:15:41:00