Use adfind from www.joeware.net instead of dsquery.

 

Adfind -default -f
"(&(objectCategory=Person)(objectClass=User)(homeDirectory=\5c\5cmydirectory
path*))" -csv sAMAccountName givenName profilePath homeDirectory >
c:\temp\scripts\adinfo\hd.csv

 

Adfind has been around a long time, much longer than dsquery, and is much
more powerful.  Basic syntax for dsquery was basically stolen from adfind. J


 

From: MarvinC [mailto:[email protected]] 
Sent: Wednesday, February 25, 2009 12:27 PM
To: NT System Admin Issues
Subject: Re: A simple yet...not so simple ??

 

This may seem dumb but what's the best way to add additional attributes and
have them delimited in spreadsheet form? It wants to place everything into
one row and I'm tried using commas to no avail.

 

dsquery * domainroot -limit 3000 -filter
"(&(objectCategory=Person)(objectClass=User)(homeDirectory=\5c\5cmydirectory
path*))" -attr sAMAccountName givenName profilePath homeDirectory >
c:\temp\scripts\adinfo\hd.csv

 

tia


 

On Wed, Feb 25, 2009 at 10:42 AM, MarvinC <[email protected]> wrote:

Abso-freakin-YES!! 

 

Thank you sir!

On Wed, Feb 25, 2009 at 10:16 AM, Michael B. Smith
<[email protected]> wrote:

You are close.

 

dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User)(homeDirectory=\5c\5cmyserver))"
-attr sAMAccountName homeDirectory > c:\temp\scripts\adinfo\hdprofile.txt

 

Notice that I removed an extra slash you had in there. I tested this, it
works. Note that you PROBABLY want a "*" after myserver. You shouldn't be
able to specify a servername without a share as a home directory.

 

From: MarvinC [mailto:[email protected]] 
Sent: Wednesday, February 25, 2009 9:17 AM 


To: NT System Admin Issues

Subject: Re: A simple yet...not so simple ?? 

 

Tried that with this and still no luck: 

 

 

dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User)(homedirectory=\5c\5c\myserver$)
)" -attr sAMAccountName homeDirectory > c:\temp\scripts\adinfo\hdprofile.csv

and with this:

 

 

dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User)(homeDirectory=\5c\5c\myserver))
" -attr sAMAccountName homeDirectory > c:\temp\scripts\adinfo\hdprofile.txt

 

 

and with this: 

 

dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User)(homeDirectory=\directorypath))"
-attr sAMAccountName homeDirectory > c:\temp\hdir.csv


 

What am I missing?

 

 

On Tue, Feb 24, 2009 at 10:10 PM, KenM <[email protected]> wrote:

try (homedirectory=\5c\5cdirectorypath) 







On Tue, Feb 24, 2009 at 9:48 PM, MarvinC <[email protected]> wrote:

dsquery * domainroot -filter
"(&(objectCategory=Person)(objectClass=User)(homeDirectory=\\directorypath))
" -attr sAMAccountName homeDirectory > c:\temp\hdir.csv

  

This "simple" query is suppose to write all domain users who homeDirectory
path resides on a particular server. The file gets created and there are no
errors but nothings' written to it. Can someone quide me on what it is I'm
doing wrong?

 

Any responses appreciated

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to