Amazing what 5 hours sleep will do!  This takes about 10 seconds to run
and puts to a csv file.  Hopefully this helps someone else!

C:\>csvde -f output.csv -d "OU=My Email
Contacts,OU=EmailStff,DC=Steve,DC=Schofield,DC=com" -r "(objectClass=*)"
-l mailNickName,cn -j c:

>>> [EMAIL PROTECTED] 08/18/04 11:42PM >>>
I wouldn't have come up with this in a million years, guess shell
scripting
in Windows is something i need to learn beyond programming in .NET. 
I'm
guessing the ~0,30 is the first thirty spaces in the line? It appears
to
work but i changed the OTHERattr to mailNickName and the comma gets put
at
the end instead of in the middle.  thanks though, any references
anywhere to
help pick this *shells scripting* in windows.  I normally do all my dev
in
vbscript or using VB.NET.

Steve


----- Original Message ----- 
From: "Dean Wells" <[EMAIL PROTECTED]>
To: "Send - AD mailing list" <[EMAIL PROTECTED]>
Sent: Wednesday, August 18, 2004 7:25 PM
Subject: RE: [ActiveDir] Specify Delimiter in output using DSQuery?


> Certainly not as easy (using base OS tools) as I would have hoped and
I'm
> sure there's an easier way to do it, this is the first that sprung to
_my_
> mind.  With any luck, this should do the job ... it's a shell script
so
dump
> it into something named <whatever>.cmd -
>
> [SCRIPT]
> @echo off
>
> set OTHERattr=samAccountName
> set FILENAME=C:\output.txt
> set DN=OU=ECbox Users,DC=mset,DC=local
>
> setlocal ENABLEDELAYEDEXPANSION
>
> for /f "tokens=* skip=2" %%o in ('dsquery * "%DN%" -limit 40000
-attr
> %OTHERattr% cn') do (
> set LINE=%%o
> set CN=!LINE:~0,30!
> set MAIL=!LINE:~32!
>
> set CN=!CN:  =!
> set MAIL=!MAIL:  =!
>
> set LINE=!CN!,!MAIL!,
>
> set LINE=!LINE: ,=,!
>
> echo !LINE:~0,-1! >>%FILENAME%
> )
> [/SCRIPT]
>
> Substitute the variables OTHER, FILENAME and DN to suit your
scenario.
>
> Hope this helps.
>
> Deano
>
> -- 
> Dean Wells
> MSEtechnology
> * Email: [EMAIL PROTECTED] 
> http://msetechnology.com 
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Charlie
Kaiser
> Sent: Wednesday, August 18, 2004 7:06 PM
> To: [EMAIL PROTECTED] 
> Subject: RE: [ActiveDir] Specify Delimiter in output using DSQuery?
>
> I was able to take this output as a .csv file, then open it in excel,
and
> use the text-to-columns feature and fixed-width rather than
delimited, and
> then save it. It produced a comma-delimited file that accurately
separated
> the two fields.
> If you can't figure out a way to create the appropriate delimiter
through
> DSQuery, this might help...
>
>
> **********************
> Charlie Kaiser
> MCSE, CCNA
> Systems Engineer
> Essex Credit / Brickwalk
> 510 595 5083
> **********************
>
>
> > -----Original Message-----
> > From: Steve Schofield [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, August 18, 2004 3:35 PM
> > To: [EMAIL PROTECTED] 
> > Subject: Re: [ActiveDir] Specify Delimiter in output using
DSQuery?
> >
> > dsquery * "OU=My Email
> > Contacts,OU=EmailOU,DC=Steve,DC=Schofield,DC=com"
> > -limit 40000 -attr mailNickName cn >  c1.txt
> >
> > Is the syntax I'm using, apologize for not posting at first.  Hard
to
> > troubleshoot when not saying here is the error or code.
> >
> > Thanks
> >
> > Steve
> >
> >
> > >>> [EMAIL PROTECTED] 08/18/04 06:17PM >>>
> > Got to love one day requirements and deadlines, need some help
> > formatting an output file from DSQuery.  I need to export all
users
> > one OU (All objects are contacts) with their CN and mailNickName
> > attributes ONLY.  The export file doesn't appear to have a
delimiter
> > when using DSQuery, I'm needing to import this into SQL Server
2000.
> > Any utilities that will allow to export to an txt file with a
> > delimiter on certain attributes from AD.  HELP!
> >
> > STeve Schofield
> > [EMAIL PROTECTED] 
> > List info   : http://www.activedir.org/mail_list.htm 
> > List FAQ    : http://www.activedir.org/list_faq.htm 
> > List archive:
> > http://www.mail-archive.com/activedir%40mail.activedir.org/ 
> > List info   : http://www.activedir.org/mail_list.htm 
> > List FAQ    : http://www.activedir.org/list_faq.htm 
> > List archive:
> > http://www.mail-archive.com/activedir%40mail.activedir.org/ 
> >
> List info   : http://www.activedir.org/mail_list.htm 
> List FAQ    : http://www.activedir.org/list_faq.htm 
> List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/ 
>
>
>
> List info   : http://www.activedir.org/mail_list.htm 
> List FAQ    : http://www.activedir.org/list_faq.htm 
> List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/ 
>

List info   : http://www.activedir.org/mail_list.htm 
List FAQ    : http://www.activedir.org/list_faq.htm 
List archive:
http://www.mail-archive.com/activedir%40mail.activedir.org/
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to