schtasks /Change /DISABLE /TN "\Microsoft\Windows\Defrag\ScheduledDefrag"
schtasks /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log1.txt
schtasks /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log2.txt
C:\>more log1.txt
Folder: \Microsoft\Windows\Defrag
TaskName Next Run Time Status
======================================== ====================== ===============
ScheduledDefrag N/A Disabled
C:\>more log2.txt
Folder: \Microsoft\Windows\Defrag
TaskName Next Run Time Status
======================================== ====================== ===============
ScheduledDefrag N/A Disabled
Unfortunately, it doesn't work for me.That's the right command, but I tested if Windows changed the setting.
Post-Setup (Machine):
Post-Setup (User):Code:schtasks /Change /DISABLE /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" schtasks /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log1.txt
Code:schtasks /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log2.txt
Code:C:\>more log1.txt Folder: \Microsoft\Windows\Defrag TaskName Next Run Time Status ======================================== ====================== =============== ScheduledDefrag N/A Disabled C:\>more log2.txt Folder: \Microsoft\Windows\Defrag TaskName Next Run Time Status ======================================== ====================== =============== ScheduledDefrag N/A Disabled
After first reboot: Disabled.
After installing Updates, and reboot: Disabled.
I didn't fully understand how to organize it all with log files. Why do you need 2 identical ones? Thank you in advance.Did you try the three commands, from Post-Setup? If both logs say "Disabled", your problem is happening outside of NTLite.
And how to implement it correctly? Why exactly 2 different files with the same content?1st log confirms that "schtasks /Disable" works as you requested, during Post-Setup (Machine).
2nd log confirms again the task is Disabled, during Post-Setup (User).
If both files report "Disabled", then whatever happened to re-enable the task wasn't part of Post-Setup. This would suggest it was triggered by something else you later installed, or was pushed by Windows Update (?).
schtasks | /Change /DISABLE /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" |
schtasks | /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log_Machine.txt |
schtasks | /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log_User.txt |
The point is basic troubleshooting: you run a command and immediately check if that command worked or not. Then we check again later if anything changed its setting. There are two opportunities to confirm, in Machine and User phases, by logging the /query to separate files.
If you don't log the task's state, then we can't go back and understand what's happening.
Machine commands:
schtasks /Change /DISABLE /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" schtasks /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log_Machine.txt
User commands:
schtasks /query /TN "\Microsoft\Windows\Defrag\ScheduledDefrag" > C:\log_User.txt
There are no UAC icons since I have disabled it completely. It says that it is disabled. I also can't figure out what's wrong with the text in the log files, it's not displayed correctly.I can't read Russian (or Ukranian), and machine translation of this screen image doesn't work. Does it say "Disabled"?
Your defrag Control Panel has no UAC icons next to each button. Why is that?
View attachment 11281
You have some other problem. schtasks /query says "Disabled".
View attachment 11282
Defrag is not scheduled. This is from a clean W11 23H2 install.
View attachment 11283