I am a bit unsure how to explain my problem, so bear with me.
I Building synthetic user simulation for integration into a monitoring system (SCOM 2012). To do this I write small tests of a proprietary application that simulates certain actions. For these tests I use AutoIT - a scripting Tool that lets you automate
Windows interaction. In AutoIT I then call a small program I wrote. This program has 3 parameters:
install: installs my performance counters
list: lists the counters
publish: take an additional 2 params, name of the counter, value to publish to the counter
This Works fine when I run it manually. I can see in perfmon that the data is correctly published.
Now, I need to run these simulations on a Schedule, so I changed the Task Scheduler service to allow interact with desktop and then I run the AutoIT scripts from a task Schedule. I see the programs are running fine with no problems - only a small exception...
no data is published to the performance counters. Leave the machine on which I run these tests, logged on and not locked (some issues with automation block me from running this on a locked machine).
The Schedule is set to run with my account, so from that perspective Things *should* be fine.
The bomb for me right now is that, if I log on to the machine, start perfmon and the manually run the autoit scripts one time - the perfcounters get the published data ... AND the scheduled task correctly publishes data to the counters too. I'm confused
I Wonder if there is something around initialization or something else I'm missing in my code - which is super simple. I have these pieces of VB.NET:
Init a counter looks like this:
Dim CounterDatas As New CounterCreationDataCollection()
' Create the counters and set their properties.
Dim cdCounter1 As New CounterCreationData()
cdCounter1.CounterName = "OpenApp_1_Open"
cdCounter1.CounterHelp = "Help"
cdCounter1.CounterType = PerformanceCounterType.NumberOfItems64
"ProArc Category Help", PerformanceCounterCategoryType.SingleInstance, _
Writing to a counter looks like this:
Dim PC As New PerformanceCounter("ProArc", countername, False)
PC.RawValue = datavalue
Console.WriteLine(countername & " < " & datavalue)
Catch ex As Exception