New
#31
Chris,
It's not that you have not got that far, it's that you have skipped over it and created the TS task yourself. That's fine.
Make sure you have clicked on Enable all tasks history on the right-hand side of TS.
Double-click on the task to show its properties tabs, select History, widen the columns by dragging their dividers around [you have to do this every time you look], see whether the task ran or not.
In my test, my simple script ran.
Your script baffles me.
The script runs when you are already shutting down but you are using it to issue a shutdown command.
I suggest an alternative script, a batch script, for testing purposes.
You will need to change the TS task properties, General tab; set the checkbox for Run with highest privileges.
You will need to change the folder path in the TS task action & in the batch file to point to a real folder on your computer.
TempTest.bat
echo This ran at %Date% %Time% >>D:\Desktop\TempTestResults.txt
and change the TS task Action to
D:\Desktop\TempTest.bat
When you've seen that that works, add an additional action to run a vbs MsgBox script. I suggest the one in my post #20.
That will demonstrate that the task runs, the TempTestResults.txt gets updated but the MsgBox does not display.
You can repeat the test with Run whether the user is logged on or not and you'll get the same results - you will hear a beep when the vbs tries & fails to display the MsgBox.
Now you will need to go back to in my post #8 and use NirSoft FullEventLogView to look for an event earlier in the shutdown process - before the logoff event.
- You will need one that still works even without Run with highest privileges or Run whether the user is logged on or not set because you want other users to do this.
- The Logoff events are
Log Microsoft-Windows-User Profile Service/Operational
Source User Profile Service
EventIDs 3,4
When moving back and forth with logs, do note that the time recorded in TempTestResults.txt are slightly delayed because it takes time to write in that file. In my tests this was about a second.
This is all rather painstaking & extremely dull.
I appreciate that all this will make you think you don't know how to do it but that is not true.
You have demonstrated that you know how to run a TS task for an EventID and that's the sophisticated part of the job.
Now all you need to do is find an event that fits in with your needs.
All the best,
Denis
Last edited by Try3; 04 Sep 2022 at 11:44.