While Implementing monitoring for Schedule tasks with SCOM 2012 , we utilized a community management pack
http://rburri.wordpress.com/2008/02/14/windows-scheduled-tasks-management-pack-for-opsmgr-2007/
After we imported the MP , we started receiving a lot of alerts related to some tasks which no one knew about .
It was a schedule task related to User profile manager software that we had tested.
We wanted to delete this schedule task on all the machines that raised the alert
In order to find the machines , we used the following SQL query against Opsmgr db
SELECT MonitoringObjectPath,MonitoringObjectName, AlertStringName, AlertStringDescription, MonitoringRuleId, Name
FROM Alertview WITH (NOLOCK)
WHERE TimeRaised is not NULL
AND AlertStringName like 'Scheduled Task failed to complete successfully'
And MonitoringObjectName like '\updater.exe'
Then i created a batch file with the following content schtasks /delete /F /TN "updater.exe"
where updater.exe was the name of the Task
We used psexec to execute the command remotely on all 75 machines.
First we saved psexec and a text file that has the list of all machine names
then we executed the command as
psexec.exe -u domain\username -p password @pc.txt \\fileserver\DeleteTask.cmd
weher pc.txt is the file which contains the name of all the computers that had the alert
deletetask.cmd is the file which does the following:
schtasks /delete /F /TN "updater.exe"
Hope this helps
http://rburri.wordpress.com/2008/02/14/windows-scheduled-tasks-management-pack-for-opsmgr-2007/
After we imported the MP , we started receiving a lot of alerts related to some tasks which no one knew about .
It was a schedule task related to User profile manager software that we had tested.
We wanted to delete this schedule task on all the machines that raised the alert
In order to find the machines , we used the following SQL query against Opsmgr db
SELECT MonitoringObjectPath,MonitoringObjectName, AlertStringName, AlertStringDescription, MonitoringRuleId, Name
FROM Alertview WITH (NOLOCK)
WHERE TimeRaised is not NULL
AND AlertStringName like 'Scheduled Task failed to complete successfully'
And MonitoringObjectName like '\updater.exe'
Then i created a batch file with the following content schtasks /delete /F /TN "updater.exe"
where updater.exe was the name of the Task
We used psexec to execute the command remotely on all 75 machines.
First we saved psexec and a text file that has the list of all machine names
then we executed the command as
psexec.exe -u domain\username -p password @pc.txt \\fileserver\DeleteTask.cmd
weher pc.txt is the file which contains the name of all the computers that had the alert
deletetask.cmd is the file which does the following:
schtasks /delete /F /TN "updater.exe"
Hope this helps
Comments
Post a Comment