Count Results

This topic contains 1 reply, has 1 voice, and was last updated by  Don Jones 4 years, 11 months ago.

  • Author
  • #7299


    running a one liner to remove enterprise vault from a number of mailboxes, it runs successfully and shows results on screen and to a text file.  I would simply like to have a total at the bottom of the results indicating how many were completed, I've tried various ways to accomplish this and at best it came back with 10 items completed but actually there were only 3 items completed.

    D:\PROGRA~1\ENTERP~1\evpm.exe -e Server1 -m EVServer1 -f D:\PROGRA~1\ENTERP~1\zap.ini | tee-object -filepath "D:\PROGRA~1\ENTERP~1\zap-log\$(get-date -f yyyy-MM-dd)-Server1.txt" | Write-Host

    Here's the screen output:

    Creating privileged MAPI session ...

    Parsing input file: D:\PROGRA~1\ENTERP~1\zap.ini

    Processing input file

    Processing mailbox: /o=Test/ou=Exchange Administrative Group (Test)/cn=Recipients/cn=TestMBX1

    Processing mailbox: /o=Test/ou=Exchange Administrative Group (Test)/cn=Recipients/cn=TestMBX2

    Processing mailbox: /o=Test/ou=Exchange Administrative Group (Test)/cn=Recipients/cn=TestMBX3

    What I'm trying to accomplish is to have "3 total mailboxes completed" at the bottom of the above output.

  • #7319

    Don Jones

    Meh. Unfortunately you're not actually running a PowerShell command, so you're just getting text. I'd suggest piping it to Select-String and selecing on something like "Processing mailbox" as your pattern. Pipe that to Measure-Object and it should count the matches.

You must be logged in to reply to this topic.