Discussion Locked

Automatic Logging in W2K...

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi All,

This question extends my previous question about Performance Monitoring and offers a further 200 points.
My problem is that I have spent yesterday and today trying to get perfmon to run a log from 9am to 6pm, and then when the logging stops, email us in the IT department with the log that we can save this locally, and try to automate the whole process... but perfmon does not allow this easily (hnce the question!). To solve this, I have written a VBScript (as mentioned earlier) that opens Outlook, sends a mail with an attachment (that days log)and closes Outlook (if it is not already open).
This script runs fine from the command prompt, but for some reason, when I try to run it from the schedule tab in perfmon, it won;t work!!!(See earlier question)
I am assuming through lack of answering my previous question that this is as hard to answer for y'all (southern accent) as it is for me!
I have been trying all sorts of workarounds including running multiple batch files, including one opening a seperate command prompt, and then running the batch file that runs the script!
To no avail.

Now to the point! Does anyone know how to accomplish this task any other way? Preferably without resorting to 3rd party solutions, but such suggestions would be acceptable, and worth a few points.
Please let me know...
Essentially I want to run a performance monitor for work hours, then email the results to a number of people each day.

Thanks all in advance,

Will

9 replies

by shanghai sam

I think I can offer you a possible explanation and solution.

Without knowing the exact conditions in you tests, I can make this guess. Some email components require that a user be logged in. This is because the email settings are made when a user logs in. Depending on how you wrote the vbscript, this could be a problem. It would work at the command line because you are logged in and a profile is active. If you schedule it to run and then log out, Outlook doesn’t have a profile loaded and will fail. This is only one possibility that I have run into.

A possible solution: It uses a third party dll, but the good news is it is free. You can download the dll from http://www.ostrosoft.com/smtp.html. After that, everything is simple. You can use the examples in the VBScript section to complete the script you have already started. You will need to register the smtp.ocx on the workstations that you want to send email from. Point them at your SMTP server and away you go.

by will shakespeare

Sorry, but as you may have seen from my other comments, this didn't help much, but thanks for trying. It turns out Blat,exe suggested by the chap below was the best solution to my immediate problem, doing away with the vbscript altogether.

by joseph moore

I think this is just a problem with the security context that the Scheduled Tasks runs under.
Try this. Open up the Local Security Policy (Control Panel ->Administrative Tools ->Local Security Policy) and open up Security Settings -> Local Policies-> User Rights Assignment.
Check two settings, the Log On Locally and Log On As A Service.
The old problem with scheduling tasks in NT4 was a matter of local machine security settings; the Local System account did not have enough rights to run stuff across a network or even on the local machine itself.
So, try this. Take a Administrator account (either a local machine Administrator or your Domain-level Administrator) and add this account to the two local security settings I mentioned above.This will give this one account those two local rights.
Then, go to Services, and go to the Task Scheduler service. Go to Properties for this service.
Click the LogOn tab, and choose the option This Account. Hit the Browse button and choose this one account you just added to the local security settings. Type in the correct password for this account.
THEN, just to really make sure, go to the Scheduled Task you made to run your script, and add this same account in the Run As option.

The whole point here is to make sure the right account with enough power is the one that is being used by the Scheduled Task.

Hope this helps.

by will shakespeare

Sorry, but when I changed the permissions and tried to restart the task schedulaer service I had problems, and errors so I had to restart it with the System account to work properly again... thanks for trying tho...

by timthetoolman

Hi,

Just to reply to your comment... In order to narrow it down further, try the script you have in task scheduler rather than Perfmon. If it doesn't work there, then you can rule out a Perfmon specific problem.

Some time ago I tried to automate creation of self extracting zip files with various utilities and it turned out that most of them wouldn't run without being able to interact with the desktop - even though they didn't appear to actually do so!

The problem you're having smells very much of that problem...

Cheers,
Tim.

by will shakespeare

Perfect... Blat solved all my problems! :)
But before that I did try the script in the Task Scheduler, and got the same result... net send worked, but the script did not... so I downloaded blat, and have tested it a few times, and it works both inperfmon and the Task Scheduler... it must have been something to do with the desktop, tho for the life of me I can't figure out what... when you run the vbscript from the command line, it comes up with similar messages as the Blat program does... but blat works, and the vbscript doesn't... :)

by will shakespeare

Hi All,
Before I rate these answers, I need to be in work on Monday, and try them out. I am skeptical though, because the batchfile that I have setup to run the vbscript does run (which is why when I rem out the vbscript part) and add a net send command to it, then run it in perfmon, it works fine. Which says to me the task is being performed. Outside of perfmon, the batchfile and script all run as they should do. Inside perfmon, the batch file is executed, along with any commands in it, EXCEPT the vbscript! (madness!)
Anyway, just to put down the idea about Outlook profiles, I have included in the script a line that chooses the correct profile (admin) to use, and a checking capability so that if Outlook isn't open at runtime, it closes it when finished, or if Outlook is open, then it leaves it open, therefore not interrupting anyone using it when the script is run.
Thanks again, and I will get back to you all on Monday.

Will

This discussion is closed to new replies.