Results 1 to 1 of 1

Thread: Formatting server reports from a .bat ?

  1. #1
    ALT0153™ Rob_B's Avatar
    Join Date
    Jul 2006
    Posts
    6,751
    Thanks
    468
    Thanked
    1,070 times in 695 posts

    Formatting server reports from a .bat ?

    Hi guys, I’m a novice when it comes to .bat so am hoping someone can help with this (what I think is gonna be dead obvious & simple) question!

    I run some reports for servers at work, it connects to a few servers, runs 2 commands then brings back the results in a .txt for each server. I then have to look through these for the below lines in those .txts

    -1
    Not Sync


    I’d like to automate this last bit if possible!

    Currently the batch file contains this:

    -------------
    Set CURRDATE=%TEMP%\CURRDATE.TMP
    Set CURRTIME=%TEMP%\CURRTIME.TMP

    DATE /T > %CURRDATE%
    TIME /T > %CURRTIME%

    Set PARSEARG="eol=; tokens=1,2,3,4* delims=/, "
    For /F %PARSEARG% %%i in (%CURRDATE%) Do SET YYYYMMDD=%%k%%j%%i

    del errorDQG0.txt

    psexec \\IP ADDRESS -u .\USER -p PASSWORD dscontrol.cmd manager report >> DQG0_farm_check_%YYYYMMDD%.txt

    psexec \\IP ADDRESS -u .\USER -p PASSWORD dscontrol.cmd higha status >> DQG0_farm_check_%YYYYMMDD%.txt


    find "-1" “Not Sync” DQG0_farm_check_%YYYYMMDD%.txt
    ::find "-1" DQG0_farm_check_%YYYYMMDD%.txt
    if errorlevel 1 copy DQG0_farm_check_%YYYYMMDD%.txt errorDQG0.txt

    del DQG0_farm_check_%YYYYMMDD%.txt

    pause
    ---------------------
    (one line commented out on purpose for now)

    But this doesn't bring back results in ‘errorDQG0.txt’ whether it finds the strings or not! Another edit I made (which was error level 0) DOES create a file but whether it finds the string or not!

    How can I write it so that

    a) It only gives me an errorxxxx.txt file if it DOES find ‘-1’ or ‘Not Sync’ (xxxx will be the server name)

    b) I can tell it to search for both strings in one go. (just put "-1" "Not Sync" ??

    c) For future use, it gives one error.txt file containing ALL servers with errors rather than individual text files.

    Thanks for any help guys!!
    Last edited by Rob_B; 05-01-2009 at 05:50 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Looking Through Windows
    By Paul Adams in forum Software
    Replies: 16
    Last Post: 19-10-2018, 09:07 AM
  2. Best Network Print Server? Linux?
    By joshwa in forum Software
    Replies: 17
    Last Post: 12-07-2008, 08:57 AM
  3. Replies: 5
    Last Post: 26-04-2008, 06:45 PM
  4. VPN Server 2003 and DG834GT
    By pcpower in forum Networking and Broadband
    Replies: 1
    Last Post: 21-08-2007, 08:37 PM
  5. 24/7 dogfight server up
    By Hat in forum PC
    Replies: 13
    Last Post: 26-10-2003, 11:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •