Late to the party, but I would use sed for this, no question. --Steve
On Fri, Oct 28, 2011 at 2:08 PM, Kurt Buff <kurt.b...@gmail.com> wrote: > Get cut.exe from either https://gnuwin32.st.net or http://unxutils.sf.net. > > Then set up the command line something like this: > > c:\automate\adfind -b ou=main,cn=users,dc=nwea,dc=org -csv -f > "&(objectcategory=user) (mail=*@nwea.org*)" -csvnoq -nodn mail CN > streetAddress postalCode title company department > physicalDeliveryOfficeName telephoneNumber manager -csvdelim \t | cut > -d, -f 1,2 > C:\automate\ftp\nweaoutput.txt > > Explanation: the 'cut' command parses input on stdin, and in this case > sets the delimiter to the comma character, and the takes the first and > second fields. This does leave the cruft 'CN=' before the full name, > but strips away everything after the name. > > You can further massage the output to get rid of the 'CN=' with 'sed' > from the same place you get 'cut' - I'll leave that as an exercise for > you... > > Kurt > > On Fri, Oct 28, 2011 at 09:54, David Lum <david....@nwea.org> wrote: >> Looking for 100% hands free export and FTP >> >> Here's the first batch file, works as advertised: >> c:\automate\adfind -b ou=main,cn=users,dc=nwea,dc=org -csv -f >> "&(objectcategory=user) (mail=*@nwea.org*)" -csvnoq -nodn mail CN >> streetAddress postalCode title company department physicalDeliveryOfficeName >> telephoneNumber manager -csvdelim \t > C:\automate\ftp\nweaoutput.txt >> >> If I add "manager" it all goes to pot. >> >> Dave >> >> -----Original Message----- >> From: Anders Blomgren [mailto:chanks...@gmail.com] >> Sent: Friday, October 28, 2011 9:05 AM >> To: NT System Admin Issues >> Subject: Re: ADFIND >> >> Yeah, -nodn is just to stop adfind from outputting the dn for each object >> found no matter what attributes you find. If you're doing a larger report >> and not including group memberships, just add -csv and redirect to file. >> Then open in excel and text to column twice, once for the file and once more >> for the manager column. >> >> -Anders >> >> Sent from my iPhone >> >> On 28 okt 2011, at 17:58, David Lum <david....@nwea.org> wrote: >> >>> Eh, answered my own Q. I already have -nodn in the command line...adding it >>> again in front if manager predictably had no effect. >>> >>> -----Original Message----- >>> From: David Lum [mailto:david....@nwea.org] >>> Sent: Friday, October 28, 2011 8:52 AM >>> To: NT System Admin Issues >>> Subject: RE: ADFIND >>> >>> AH! Do you use -nodn in front of *each* field that might contain all that >>> stuff? >>> >>> -----Original Message----- >>> From: Kurt Buff [mailto:kurt.b...@gmail.com] >>> Sent: Friday, October 28, 2011 8:38 AM >>> To: NT System Admin Issues >>> Subject: Re: ADFIND >>> >>> adfind -b dc=mycompany,dc=com -f "samaccountname=kbuff" -nodn manager >>> >>> On Fri, Oct 28, 2011 at 06:14, David Lum <david....@nwea.org> wrote: >>>> ADFIND is outputting the complete details of the "manager" field >>>> (CN=BillyBob,CN=Users,DC=nwea,DC=org), anyone here how to to make it >>>> output just the manager's CN? Probably some piping needed in the >>>> command line right? Just can't get my head around it this morning... >>>> >>>> David Lum >>>> Systems Engineer // NWEATM >>>> Office 503.548.5229 // Cell (voice/text) 503.267.9764 >>>> >>>> >>>> >>>> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ >>>> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >>>> >>>> --- >>>> To manage subscriptions click here: >>>> http://lyris.sunbelt-software.com/read/my_forums/ >>>> or send an email to listmana...@lyris.sunbeltsoftware.com >>>> with the body: unsubscribe ntsysadmin >>> >>> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ >>> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >>> >>> --- >>> To manage subscriptions click here: >>> http://lyris.sunbelt-software.com/read/my_forums/ >>> or send an email to listmana...@lyris.sunbeltsoftware.com >>> with the body: unsubscribe ntsysadmin >>> >>> >>> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ >>> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >>> >>> --- >>> To manage subscriptions click here: >>> http://lyris.sunbelt-software.com/read/my_forums/ >>> or send an email to listmana...@lyris.sunbeltsoftware.com >>> with the body: unsubscribe ntsysadmin >>> >>> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ >>> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >>> >>> --- >>> To manage subscriptions click here: >>> http://lyris.sunbelt-software.com/read/my_forums/ >>> or send an email to listmana...@lyris.sunbeltsoftware.com >>> with the body: unsubscribe ntsysadmin >> >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ >> <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >> >> --- >> To manage subscriptions click here: >> http://lyris.sunbelt-software.com/read/my_forums/ >> or send an email to listmana...@lyris.sunbeltsoftware.com >> with the body: unsubscribe ntsysadmin >> >> >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ >> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >> >> --- >> To manage subscriptions click here: >> http://lyris.sunbelt-software.com/read/my_forums/ >> or send an email to listmana...@lyris.sunbeltsoftware.com >> with the body: unsubscribe ntsysadmin >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to listmana...@lyris.sunbeltsoftware.com with the body: unsubscribe ntsysadmin