Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Scheduling Perfmon

Posted on 2008-06-16
6
Medium Priority
?
3,152 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 750 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 750 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a common problem that often server suffers from the lack of space on system volume. Old servers or new ones from vendors come with preformatted small volume - 5-6GB in total and after installing updates or applications the free space on system…
I originally wrote this article to compare SARDU and YUMI, but have now added Easy2Boot, since that is the one I currently use and find the easiest to create and alter.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

963 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