SCCM 2007 Advertisment Run Notification Timer - sccm

where (in the WMI?) is the timer located if the SCCM Client Agent 2007 is about to run a specific mandatory Advertisment?
I would like to shorten the 10 Minutes delay to some seconds with a Script or via a C# command. But not generally. Only if it has to be done urgent.
The message says "This program will begin running in xx minutes xx seconds"
I know that there exist a "ADV_RunNotificationCountdownDuration" in the CCM_SoftwareDistribution under the root\CCM\policy\machine\actualConfig, but this field is empty. And i dont know where the Actual Minutes left are stored.

Have you looked in the
System Center Configuration Manager 2007 Software Development Kit ?

You might want to look at IUIResourceMgr::ExecuteProgram Method
It should force the client to run the program immediately.
If you want to reduce the duration of the countdown, you can change the ADV_RunNotificationCountdownDuration value. Unfortunately it only takes effect after re-running the advertisments. Do take note, the value would revert back to your site settings once a policy refresh occurs.

Related

Scheduled task fails to run, no error code

We're using a scheduled task to run a simple executable every 2 minutes, it has a working directory set (no quotes round the path) but other than that most options are left as defaults.
Running the task manually by right-clicking on it and selecting Run works just fine, however it never executes automatically. When the time comes to run the task, it just increments the "Next Run Time" field by 2 minutes and that's it. The Last Run Time Field is always the last time the task was manually executed.
The Last Run Result is always 0x0.
I've tried setting it to run as the current user, or as an alternate user set up with administrative privileges and a stored password, but still no luck.
There doesn't appear to be anything immediately obvious in the system event log either to indicate the cause of the failure.
As a bit of background, this is a headless Win10 Pro machine (only ever accessed via LogMeIn) running control software for external hardware. It reboots every morning at 03:00 and since it's on an physically isolated network, automatically logs in to a user account with administrative privileges and no password.
I suspect it may be a permissions issue with the insecure way the system is set up, however at this point there's little to go on.
Any ideas?
Thanks
For posterity, this turned out to be an issue with the way the repetition on the scheduled task was set up. Initially it was set up as a daily task to run every 2 minutes for 24 hours. Whilst this showed the correct next run time in the task scheduler window, for some reason it never executed - Bug?
The fix was instead to set the task up as a one time event that repeats every 2 minutes indefinitely, which seems to be working properly now.

Scheduled task run .bat once a week Win7

I need to have a .bat run once a week when I log onto the computer. I tried several things and if im not logged on then the .bat fails. but works if I am logged on when its scheduled to start. What setting in windows 7 scheduled task makes is keep trying untill I log in? Or am I doing something incorrect?
My settings:
GENERAL:
Run only when user is logged on (Yes)
Configure for: Win7, Win Server 2008 R2
TRIGGER:
Begin the task: On a schedule
Weekly (Yes)
Recur Every : 1 weeks on Tues # 8p
Enabled (Yes)
SETTINGS:
Allow task to be run on demand (Yes)
Run task as soon as possible after a scheduled start is missed (Yes)
If the task fails, restart every... 5 min up to 50 times for 3 days
Thanks!
Did you set up your task to run as you, regardless if you are logged in?
Control Panel -> Task Scheduler. Go to the properties of your task, then under the General tab verify that your user account is specified under the "use the following user account". You will probably also be prompted for your password.
Oooh - sore point! Massive argument with the expert System Administrator at my last job when she couldn't arrange for a scheduled job to start unless the user was logged in. Claimed it was a well-known problem that NO-ONE had ever solved - not even Microsoft (who'd published a fix nearly three years earlier.)
So, I'm not surprised that you're having trouble when an EXPERT (on everything) who'd won industry awards for the quality of her work couldn't get it going.
I think the major problem is in the data you've posted,
GENERAL:
Run only when user is logged on (Yes)
Which just might mean "Run only when the user is logged in."
So - if you'd explain what it is you want to do, we might be able to progress to some conclusion.
Do you want the process to run at a particular time on a particular day, whether the user is logged in or not, or do you want it to run IF the user logs in on that day (but no others) or every 7th day the user logs in or some other condition? Remember - calendar days and work-days are different - public holidays, vacations, whatever come into play...

Need to send email notification on visual studio run

I'm executing a test-execution project using visual studio 2005 (using the pnunit framework and C# but its not relevant). The total execution time is more than 40 hours. In between if there are any environment problems on the network (external factors like remote server is down, db is down etc) the code stops executing. This creates a problem because when I notice the error I'll have to manually set external factors right and again resume the run. So it becomes important to keep checking the execution progress frequently to make sure we are not losing time due to halted execution, which is troublesome.
I looking for a way to somehow either triggering an email/batch script/exe/anything when the code stops running. Is there any way I could achieve this? Any ideas?
Thanks,
Mugen
If you only need to trigger an email at the end of the application, then I would suggest putting the code here at the end of your execution.

Interview question: Develop an application that can display trial period expires after 30 days without external storage

I saw this question in a forum about how an application can be developed that can keep track of the installation date and show trial period expired after 30 days of usage. The only constraint is not to use the external storage of any kind.
Question: How to achieve this?
Thanks
Bala
--Edit
I think its easy to figure out the place to insert a question work. Anyway, I will write the question clearly. "external storage" means don't use any kind of storage like file, registry, network or anything. You only have your program.
Use the file-modified date of the file containing the program as the installation date.
I like Doug Currie's idea of the file-modification date. But if the application is downloaded from the web, every night at midnight it gets relinked with new initialized data containing the new expiration date. Then any binary downloaded that day expires on the date given.
If you like, sign the date with a private key so it can't be hacked. Include a public key in the app and decrypt the date. If not correctly signed, hasta la vista, baby.
I don't know if this is possible, as most work I've done has been with embedded systems in which I don't even need to touch the operating system. But would the following be possible?
When compiling your program, leave some extra space at the end (say, 8 bytes), all set to 0. When your application is run, it fetches those bytes and if they're all 0, replaces them with the current time (That's the part I'm not sure about. Does the OS let you do that? If not, there might be some work-arounds using multiple processes.), otherwise, if the time difference is greater than 30 days, it notifies the user that the trial period has ended.
Of course, that method would be vulnerable to resetting the system clock.
If you can't use any external storage at all (not even config files or anything like that), you would need to code it into the app itself so the app's main method (or some method) checks if the current date is less than some expiration date. Part of your installer could actually compile that code on the fly and then it would be set to the installation date. This could be easily defeated by reinstalling the app, but then again, it's not realistic to have no external storage either.
I think the only way to do this generally would be to have your application spawn something off in a separate process that would continue to run and keep track of the date/time even if the main application were closed. When it was restarted, it would then connect to the running process to see if the trial period had expired.
Of course, this would only work if the computer was never restarted and the user never hunted down your spawned process and killed it, which is pretty unlikely. If your application does not do anthing IO-related (file system, registry, something on the network etc.), then a simple restart will wipe away anything that you've done.
So, to summarize: it's not really possible.

Why are my auto-run applications acting weird on Vista?

The product we are working on allows the user to easily set it up to run automatically whenever the computer is started. This is helpful because the product is part of the basic work environment of most of our users.
This feature was implemented not so long ago and for a while all was well, but when we started testing this feature on Vista the product started behaving really weird on startup. Specifically, our product makes use of another product (lets call it X) that it launches whenever it needs its services. The actual problem is that whenever X is launched immediately after log-on, it crashes or reports critical errors related to disk access (this happens even when X is launched directly - not through our product).
This happens whenever we run our product by registering it in the "Run" key in the registry or place a shortcut to it in the "Startup" folder inside the "Start Menu", even when we put a delay of ~20 seconds before actually starting to run. When we changed the delay to 70 seconds, all is well.
We tried to reproduce the problem by launching our product manually immediately after logon (by double-clicking on a shortcut placed on the desktop) but to no avail.
Now how is it possible that applications that run normally a minute after logon report such hard errors when starting immediately after logon?
This is the effect of a new feature in Vista called "Boxing":
Windows has several mechanisms that allow the user/admin to set up applications to automatically run when windows starts. This feature is mostly used for one of these purposes:
1. Programs that are part of the basic work environment of the user, such that the first action the user would usually take when starting the computer is to start them.
2. All sorts of background "agents" - skype, messenger, winamp etc.
When too many (or too heavy) programs are registered to run on startup the end result is that the user can't actually do anything for the first few seconds/minutes after login, which can be really annoying. In comes Vista's "Boxing" feature:
Briefly, Vista forces all programs invoked through the Run key to operate at low priority for the first 60 seconds after login. This affects both I/O priority (which is set to Very Low) and CPU priority. Very Low priority I/O requests do not pass through the file cache, but go directly to disk. Thus, they are much slower than regular I/O.
The length of the boxing period is set by the registry value:
"HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DelayedApps\Delay_Sec".
For a more detailed explanation see here and here
The program probably needs some more info put into its properties. It needs to "Run As", instead of just running.
Maybe this application should be developed as a service, instead of a program to be launched, or you could have service that launches the program when its determined the best window of opportunity.

Resources