#165131 - 2006-07-27 06:59 PM
Re: LDIFDE Help
|
DrillSergeant
MM club member
   
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
Code:
strDomainName = "NetBIOS Domain Name"
ADname = GetfullName("SamAccountName")
Function GetFullName(strNT4Name) On Error Resume Next Err.Clear
Set objTrans = CreateObject("NameTranslate") objTrans.Init 3, "" objTrans.Set 3, strDomainName & "\" & strNT4Name GetFullName = objTrans.Get(1)
End Function
this is VBscript to get a distinguished name from a SamAccountName. Let me know if you need any help to convert it
|
|
Top
|
|
|
|
#165133 - 2006-07-27 07:31 PM
Re: LDIFDE Help
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I have already written that UDF - Translatename().
|
|
Top
|
|
|
|
#165134 - 2006-07-27 07:33 PM
Re: LDIFDE Help
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Quote:
LDIFDE COMMANDS: 1. Command to export the user with a given name of SAM Account ldifde -f exportuser.ldf -s computer_name -r (samaccountname=SAMLNAME) 2. Command to export Organizational Units: Running this command exports all OUs except domain controllers into a file named ExportOU.ldf. ldifde -f exportOu.ldf -s Server1 -d "dc=Export,dc=com" -p subtree -r "(objectClass=organizationalUnit)" -l "cn,objectclass,ou" 3. Export the User Accounts from the Source Domain ldifde -f Exportuser.ldf -s Server1 -d "dc=Export,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=User)(givenname=*))" -l "cn,givenName,objectclass,samAccountName" Running this command exports all users in the Export domain into a file named Exportuser.ldf. If you do not have all the required attributes, the import operation does not work. The attributes objectclass and samAccountName are required, but more can be added as needed. 4. Command to Import users from a LDF file: ldifde -i -f Exportuser.ldf -s Server2 5. Exporting User Account attributes except attributes those can’t be imported: (Using –o switch) This is another example filter that will export all User Account data except for the attributes that cannot be imported: ldifde -f Exportuser.ldf -s <Server1> -d "dc=Export,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=User)(givenname=*))" -o "badPasswordTime,badPwdCount,lastLogoff,lastLogon,logonCount, memberOf,objectGUID,objectSid,primaryGroupID,pwdLastSet,sAMAccountType" Another Example: To export for any given SamAccountName: ldifde -f Exportuser.ldf -s <Server1> -d "dc=Export,dc=com" -p subtree -r "(&(objectCategory=person)(objectClass=User)(givenname=*))" -o "badPasswordTime,badPwdCount,lastLogoff,lastLogon,logonCount, memberOf,objectGUID,objectSid,primaryGroupID,pwdLastSet,sAMAccountType"
|
|
Top
|
|
|
|
#165137 - 2006-07-27 09:14 PM
Re: LDIFDE Help
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
That info came from the Microsoft KB. Code:
Article ID : 555636 Last Review : June 6, 2006 Revision : 1.0
Edited by Howard Bullock (2006-07-27 09:15 PM)
|
|
Top
|
|
|
|
#165139 - 2006-07-27 11:18 PM
Re: LDIFDE Help
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Quote:
You could use fnLDAPQuery() as well.
Maybe, but can we trust the author to do updates when needed. He has not updated fnGetFolderProp() yet
|
|
Top
|
|
|
|
#165141 - 2006-07-28 01:23 AM
Re: LDIFDE Help
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Yep, true. But not easy for noobs who come across it and try to follow my suggestions of using:
$SO=SetOption('Explicit','On') $SO=SetOption('NoVarsInStrings','On') $SO=SetOption('NoMacrosInStrings','On')
Thus much nicer if the author updates their UDF to meet that criteria per guidelines.
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|