Skip to main content

Posts

Showing posts from January, 2017

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 timeStart perfmon on all 4 AR serversWait for 1 hrCopy 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…