Re: modifying objects in ADAM ADSIEDIT

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



what do you mean by netbios names in this case?

The hostname of the machine?
"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx> wrote in
message news:uvbal4xIJHA.3680@xxxxxxxxxxxxxxxxxxxxxxx

"joey" <joe@xxxxxxx> wrote in message
news:%23w8n6lxIJHA.1160@xxxxxxxxxxxxxxxxxxxxxxx
I need to constantly modify a few objects in ADAM ADSIEDIT manually by
travelering the directory tree. How do I script this by just modifying the
script and run it?

The first step is to identify the object to be modified in AD. You need
the Distinguished Name (DN) of the object. If you have the NetBIOS name
(the "pre-Windows 2000 logon" name of users) you can use the NameTranslate
object to convert to the DN. A script can prompt for the NetBIOS name
(also called the NT name) and convert to DN. The second step is to
identify the attribute of the object to be modifed. A VBScript program can
bind to the object in AD (using the DN) and assign a new value to the
attribute (assuming a string attribute). Special techniques are required
if the attribute is multi-valued, Integer8 (a 64-bit number representing a
date), a byte array (like SID or GUID values), or generalized time values.
If you only modify single-valued string attributes, the script could
prompt for the name of the attribute (the LDAP display name), plus the new
value. A VBScript example, using NameTranslate follows:
=============
' Constants for the NameTranslate object.
Const ADS_NAME_INITTYPE_GC = 3
Const ADS_NAME_TYPE_NT4 = 3
Const ADS_NAME_TYPE_1779 = 1

' Retrieve DNS name of the domain from the RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE";)
strDNSDomain = objRootDSE.Get("defaultNamingContext")

Set objTrans = CreateObject("NameTranslate")
' Initialize NameTranslate by locating the Global Catalog.
objTrans.Init ADS_NAME_INITTYPE_GC, ""

' Use the NameTranslate object to find the NetBIOS name of the domain.
objTrans.Set ADS_NAME_TYPE_1779, strDNSDomain
strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4)
' Remove trailing backslash.
strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1)

' Prompt for NetBIOS name of object in AD.
strNTName = InputBox("Enter NetBIOS name of object to modify")

' Use Set method to specify NT format of name.
' Trap error if object not found.
On Error Resume Next
objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName
If (Err.Number <> 0) Then
On Error GoTo 0
Wscript.Echo strNTName & " not found in Active Directory"
Wscript.Quit
End If
On Error GoTo 0

' Use the Get method to retrieve DN.
strDN = objTrans.Get(ADS_NAME_TYPE_1779)
' Bind to the object.
Set objADObject = GetObject("LDAP://"; & strDN)

' Prompt for the attribute to modify.
strAttribute = InputBox("Enter the LDAP Display Name of the attribute to
modify")

' Prompt for the new attribute value.
strValue = InputBox("Enter the new value to assign to the attribute")

' Assign the value.
' Trap the error if the value is invalid.
On Error Resume Next
objADObject.Put strAttribute, strValue
objADObject.SetInfo
If (Err.Number <> 0) Then
Wscript.Echo "Failed to assign " & strValue & " to attribute " &
strAttribute
End If
=======
You can also use Joe Richards' admod utility. See this link:

http://www.joeware.net/freetools/tools/admod/index.htm

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--




.



Relevant Pages

  • Re: modifying objects in ADAM ADSIEDIT
    ... which is the NetBIOS name I referred to. ... ' Prompt for NetBIOS name of object in AD. ... ' Prompt for the attribute to modify. ... How do I script this by just modifying ...
    (microsoft.public.windows.server.scripting)
  • Re: modifying objects in ADAM ADSIEDIT
    ... A script can prompt for the NetBIOS name ... If you only modify single-valued string attributes, ... ' Use the NameTranslate object to find the NetBIOS name of the domain. ...
    (microsoft.public.windows.server.scripting)
  • Re: modifying objects in ADAM ADSIEDIT
    ... How do I script this by just modifying the ... A script can prompt for the NetBIOS name (also called ... If you only modify ... ' Constants for the NameTranslate object. ...
    (microsoft.public.windows.server.scripting)
  • Re: Modifying a record field value while not blocking it to others
    ... And of course again the record you are trying to modify has not to be 'open' ... someone opens that ID=12 record everything in it is locked. ... often add a script line which opens a random record if the file holds enough ... system where customers use Credits when renting items and get Credits ...
    (comp.databases.filemaker)
  • Re: How to tell when a computer was joined to the domain?
    ... When I run the script ... If you know the NetBIOS name of a computer, ... NameTranslate object to convert this to the NetBIOS name of the domain. ... ' Use the Get method to retrieve the NetBIOS name. ...
    (microsoft.public.windows.server.general)