Solved

Scheduling Perfmon

Posted on 2008-06-16
6
3,110 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

911 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

21 Experts available now in Live!

Get 1:1 Help Now