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

Novell Netware
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

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

Display the Attributes and Attribute Values of an NDS object

Keywords: 	 NDS dump  display the attributes and attribute values of an NDS object

Question:

In Netware, how do I get the attribute for Group Membership.

Answer:

If you are using NDS, see the Netware extender to do this.

Otherwise... The attribute that you want to get is "Group Membership". It is an attribute of any user object that is a member of one or more groups. The value for the attribute is a list of one or more distinguished group names.

Take a look at the sample script that I have attached. It is a simple NDS dump program based on some of the sample script code in the Netware extender help files. Compile it as a .EXE file and then run it, passing in the object name that you want to dump as "param1" to the script.

This will result in a list of attribute names being presented to you. Select an attribute and its value(s) will be displayed.



; NDSDump.wbt
; 32-bit
;
; This script displays the attributes and attribute values of an NDS object.
;
;


; Figure out where we are located and then save this information for later use.

TempFile = IntControl(1004,0,0,0,0)
AppFile = TempFile
AppPath = StrUpper(FilePath(TempFile))
while (StrSub(AppPath,StrLen(AppPath),1) == '\')
  AppPath = StrSub(AppPath,1,StrLen(AppPath)-1)
endwhile
AppRoot = StrUpper(FileRoot(TempFile))
AppExtension = StrUpper(FileExtension(TempFile))


; Add in the extender that we need for the Netware v4.x environment.

AddExtender(StrCat(AppPath,"\wwn4x32i.dll"))


; Set up some other options for the Novell environment

n4SetOptions(1,@TRUE)
n4SetOptions(2,@FALSE)
n4SetOptions(3,@TRUE)

Title01 = 'NDS Object Dump Utility'

if (IsDefined(param1))
  object = param1
else
  Message(Title01,'Required parameter (param1) is missing!')
  exit
endif

context = ''

if (IsDefined(param2))
  context = param2
endif

; list all attributes and values for an object
attribs = n4ObjectProps(context, object, "")


:PickAttrib

attrib = ItemSelect(StrCat('Attributes for "',object,'.',context,'", n4Version = ',n4Version()),attribs,@TAB)
;values = n4ObjectProps(context, object, attrib)
values = n4ObjGetVal(context,object,attrib,"","")
if (StrLen(values) == 0)
  ; This must be a file stream attribute, so go ahead and find out how big it is
  ; and then allocate a binary buffer to hold it.
  BuffSize = n4ObjGetVal(context,object,attrib,-1,-1)
  if (BuffSize == 0)
    Message(StrCat('Attribute "',attrib,'"'),'Zero length for attribute values')
  else
    StreamBuf = BinaryAlloc(BuffSize)
    Temp = n4ObjGetVal(context,object,attrib,IntControl(42,StreamBuf,0,0,0),BuffSize)
    BinaryEODSet(StreamBuf,Temp)
    BinaryWrite(StreamBuf,"StreamBuf.txt")
    BinaryFree(StreamBuf)
    Drop(StreamBuf)
    Message(StrCat('Attribute "',attrib,'"'),StrCat('Stream attribute value size = ',BuffSize,', Retrieved Bytes = ',Temp))
  endif
endif

ItemSelect(attrib, values, @TAB)

goto PickAttrib



:CANCEL

exit



Article ID:   W14891
File Created: 2001:11:08:12:40:50
Last Updated: 2001:11:08:12:40:50