Starting Perfmon on all Windows machines with a single Batch file

In one of our project we have more than 4 Windows servers. We use perfmon to monitor the resource utilization. Each time we run load test we start the perfmon on all the servers.
So created the below batch file to do the job.

The batch file does the below:
  • Create a directory with current date and time
  • Start perfmon on all 4 AR servers
  • Wait for 1 hr
  • Copy the result file (.csv) from each server into the director created in step1.
  • Stop perfmon on all 4 AR servers.

@echo off

for /f %%I in ('wmic os get localdatetime ^|find "20"') do set dt=%%I
REM dt format is now YYYYMMDDhhmmss...
REM set dt=%dt:~4,2%-%dt:~2,2%-%dt:~0,4%

set dt=%dt:~6,2%%dt:~4,2%%dt:~2,2%%dt:~8,2%%dt:~10,2%
echo %dt%

mkdir D:\Perfmon\Perfmon_%dt%

logman start "Counter" -s server1
logman start "Counter" -s server2
logman start "Counter" -s server3
logman start "Counter" -s server4

timeout /t 3600

copy \\server1\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\. 
copy \\server2\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\. 
copy \\server3\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\.
copy \\server4\c$\PerfLogs\Admin\Counter\*%dt%*.csv D:\Perfmon\Perfmon_%dt%\.

logman stop "Counter" -s server1
logman stop "Counter" -s server2
logman stop "Counter" -s server3
logman stop "Counter" -s server4

Note: The Data collector with name "Counter" is already added or created in perfmon under "Data Collector Sets"-> "User Defined" on all the servers.
Note: The .csv file created was ending with ddMMyyyyhhmm format.

Comments

  1. Useful information that i have found. don't stop sharing and Please keep updating us..... Thanks

    ReplyDelete
  2. Really thankful to you. We were looking for exact same answer.

    ReplyDelete
  3. Worthful testing tutorial. Appreciate a lot for taking up the pain to write such a quality content on testing tutorial. Just now I watched this similar testing tutorial and I think this will enhance the knowledge of other visitors for suretesting training institute in hyderabad

    ReplyDelete
  4. thank your valuable content.we are very thankful to you.one of the recommended blog.which is very useful to new learners and professionals.content is very useful for hadoop learners


    Best Spring Classroom Training Institute
    Best Devops Classroom Training Institute
    Best Corejava Classroom Training Institute
    Best Advanced Classroom Training Institute
    Best Hadoop Training Institute
    Best PHP Training Institute

    ReplyDelete
  5. Thanks for sharing
    We are the best piping design course in Hyderabad, India. Sanjary academy Offers Piping Design Course and Best Piping Design Training Institute in Hyderabad. Piping Design Institute in India Piping Design Engineering.
    Piping Design Course
    Piping Design Course in india
    Piping Design Course in hyderabad

    ReplyDelete
  6. Nice Information
    "Pressure Vessel Design Course is one of the courses offered by Sanjary Academy in Hyderabad. We have offer professional
    Engineering Course like Piping Design Course,QA / QC Course,document Controller course,pressure Vessel Design Course,
    Welding Inspector Course, Quality Management Course, #Safety officer course."
    Piping Design Course
    Piping Design Course in India­
    Piping Design Course in Hyderabad
    QA / QC Course
    QA / QC Course in india
    QA / QC Course in Hyderabad
    Document Controller course
    Pressure Vessel Design Course
    Welding Inspector Course
    Quality Management Course
    Quality Management Course in india
    Safety officer course

    ReplyDelete
  7. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here
    BCOM 1st, 2nd & Final Year Exam Time Sheet 2020
    Maharaja Surajmal Brij University BCOM 1st Year Exam Time Schedule 2020

    ReplyDelete
  8. I perceived a lots of new Technical things in this wonderful site.Unique information's are shared through it.Keep working Like this
    Java training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery

    ReplyDelete
  9. Tease me until I’m begging for it Hey, i am looking for an online sexual partner ;) Click on my boobs if you are interested (. )( .)

    ReplyDelete
  10. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic...
    Java Training in Chennai

    Java Training in Velachery

    Java Training in Tambaram

    Java Training in Porur

    Java Training in OMR

    Java Training in Annanagar



    ReplyDelete
  11. I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up

    Devops Training in USA

    Hadoop Training in Hyderabad

    Python Training in Hyderabad

    ReplyDelete
  12. Thank you for sharing this useful article with us. This blog is a very helpful to me in future. Keep sharing informative articles with us.

    https://www.ahmedabadcomputereducation.com/course/laravel-training-course/

    ReplyDelete
  13. Thank you for sharing this useful article with us. This blog is a very helpful to me in future. Keep sharing informative articles with us.

    https://www.ahmedabadcomputereducation.com/course/laravel-training-course/

    ReplyDelete
  14. Thank you for sharing this useful article. This blog is a very helpful to me. Keep sharing informative articles with us.

    https://www.ahmedabadcomputereducation.com/course/ionic-training-course/

    ReplyDelete
  15. Awesome content for reading as well as knowledge. Thank you for sharing this informative article with us.

    https://www.sdsfin.in/about-us/

    ReplyDelete
  16. Thank You for sharing this informative article.

    https://web30india.com/

    ReplyDelete
  17. I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up






    ReplyDelete
  18. I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up

    Devops Training in Hyderabad

    Hadoop Training in Hyderabad

    Python Training in Hyderabad

    Tableau Training in Hyderabad

    Selenium Training in Hyderabad

    ReplyDelete
  19. I am impressed by the information that you have on this blog. It shows how well you understand this subject.
    data scientist training in malaysia

    ReplyDelete

Post a Comment

Popular posts from this blog

Steps to Analyze AWR Report in Oracle

Verifications and Error Handling in LoadRunner *Web_reg_find and Web_reg_save_param*

Examples on Date and Time in LoadRunner