Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following command; its purpose is to list any services which are running under a user account within the domain and output that information into text files within a directory. Each machine will have its own text file, within that file is a list of any services running under a user account.

The command returns- "dsquery failed:A referral was returned from the server"

If sombody could please look this command over for me?

for /f "tokens=1" %1 in ('dsquery computer
",dc=roc,dc=paychex,dc=com" -o rdn -limit 0') do
@wmic /node:%1 /failfast:on service where (StartName!="LocalSystem"
and StartName!="NT AUTHORITY\\LocalService" and
StartName!="NT AUTHORITY\\NetworkService")
get Caption,StartName > c:\temp\svc-list-%1.txt
share|improve this question

Do you actually have an OU named inside of a domain named I would say either omit the ou=..., bit altogether, or change ou=..., to reflect an actual OU structure in your domain.

If you actually do have an OU named in your domain, I'll delete this answer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.