• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Help with scripting a DSQuery request

I have the following DSQuery which outputs to a text file. I then have to pull that into a file editior and count the lines. I would like to convert this to a vbs file so I can run from a command line. The gotcha is that I am currently using findstr to filter out 'stuff'.

dsquery user dc=mydomain,DC=oc,DC=sample,DC=com -limit 0 |findstr /v /i "delete inactive SystemMailbox .adm Monitoring"|findstr /i /v "Org Accts"

Ideal output would be something like
Count: 1027
0
edrz01
Asked:
edrz01
  • 2
  • 2
1 Solution
 
Bill PrewCommented:
Try this addition to your command.

dsquery user dc=mydomain,DC=oc,DC=sample,DC=com -limit 0 |findstr /v /i "delete inactive SystemMailbox .adm Monitoring"|findstr /i /v "Org Accts"|find /c /v ""

Open in new window

~bp
0
 
edrz01Author Commented:
Solution provided was not helpful.
0
 
Bill PrewCommented:
@edrz01

==> Solution provided was not helpful.

Can you be more specific, that should have returned the count of the number of selected items, did you not get that?  Or did you get an error?

~bp
0
 
edrz01Author Commented:
bp, sorry bout that and it did produce a number.

What I was trying to accomplish was to convert this to a vbs file.

I actually need to expand this but I will close this and reopen as another question......
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now