0

I'm looking for some help with scheduled tasks. I have some few experiences but this goes a little deeper and so far I couldn't find anything to answer my question.

So what I would like to do is to create a task, which runs for any user on a very small selection of computers. The computers are connected to a domain but the GPO is not an option for this. Please don't ask why not the GPO.

I got like 3 computers on which a couple of users log into and they keep changing places because it always depends on who comes first for that day. So they always need to have their default settings.

The only problem here is that I don't know how to setup the task to run on the first/next login of every user without having them to run on every login. It would just confuse the users even more if they see something pop up every time they restart their computer or reopen their sessions so in order to avoid annoying questions, I guess every Admin can relate to this, I would like to run the command or script only on their first login or their next one if it is a change which needs to be applied.

Does anyone have any idea or tip for me for this under windows 7 pro and/or 10 Pro? Thanks in advance already.

Ahmed Ashour
  • 2,490
VarmintLP
  • 364

1 Answers1

1

Your question isn't too clear, but I think I understand that you wish to set up a switch that will cause a script to be run once on next user login (or first login if the user wasn't logged-in when the switch was set).

If you cannot use a GPO (not asking why), then this answer on our site shows how to set a script to run as a logon script for all users of a computer : Automatically run a script when I log on to Windows.

Inside the script you can use the variable %USERNAME% to access the logging user. You could, for example, modify some "maintenance-modification" file every time that you make a change that requires that action, and compare its contents with a file whose name is derived using the above variable.

For example, use the Windows FC command to compare the contents of the two files and overwrite if required using the Copy command :

fc c:\maintenance\maintenance-modification c:\maintenance\%USERNAME% > nul
if errorlevel 0 goto skip-maintenance
copy /y c:\maintenance\maintenance-modification c:\maintenance\%USERNAME%
... maintenance action ...
harrymc
  • 498,455