Solved

Scheduling Perfmon

Posted on 2008-06-16
6
3,105 Views
Last Modified: 2013-12-01
I would like to setup a schedule for perfmon to start and stop at a certain time, currently i have about 20 servers and i am doing this manually, the schedule only give you the option for the day, I would like to schedule on a M-F 9AM - 2PM, exclude holidays etc, the way you can schedule in windows backup, does anyone know how to do this ? If i am not being clear please let me know to clarify thanks!
0
Comment
Question by:z969307
  • 3
  • 2
6 Comments
 
LVL 38

Assisted Solution

by:Shift-3
Shift-3 earned 250 total points
ID: 21797454
The easiest method would probably be to create Scheduled Tasks to run LOGMAN START and LOGMAN STOP commands at the desired times.
http://support.microsoft.com/kb/303133

You can script the creation of tasks on multiple servers with FOR /F and the SCHTASKS command.
http://www.ss64.com/nt/for_f.html
http://support.microsoft.com/kb/814596

Holidays are trickier.  You might have to exclude those manually.

0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 250 total points
ID: 21797667
As an example, paste the script below into a text file with a .cmd extension.  Customize the value of the "logname" variable with the name of the Perfmon collection.  Create a text file named serverlist.txt in the same directory containing a list of servers to run the script against, one per line.

Running the script will create tasks on each server to start the collection at 9 am and stop it at 2 pm on weekdays.


@echo off

setlocal
 

set logname=Test
 

for /F %%G in (serverlist.txt) do (

 schtasks /Create /S \\%%G /RU "NT AUTHORITY\SYSTEM" /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN "Start Perfmon %logname%" /TR "logman start %logname%" /ST 09:00:00

 schtasks /Create /S \\%%G /RU "NT AUTHORITY\SYSTEM" /SC WEEKLY /D MON,TUE,WED,THU,FRI /TN "Stop Perfmon %logname%" /TR "logman stop %logname%" /ST 14:00:00

)

Open in new window

0
 

Author Comment

by:z969307
ID: 21807683
Thank You.
 I will give this a try, if it works I'll double the points.
0
 

Author Comment

by:z969307
ID: 21827170
I just got around to doing this, when i ran the cmd, it finished very quickly and i did see some success, but when i went over to the server i didn't see the counter log created, do i need to manually create one on all servers and name it under "logname" ? also to make sure the script ran fine can it be written to a log txt file ? thanks
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 21827690
You can use LOGMAN to copy the collection to other machines.  Type "LOGMAN /?" for the syntax.

Append ">> log.txt 2>>&1" to lines 7 and 8 to create a log file.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now