disabling Update Orchestrator (UsoSvc) service permanently
This service keeps reenabling the disabled (by me) Windows Update stuff etc.
But even when I disable UsoSvc, the war is not over - MS has special scheduled tasks to revert these changes back at latest at OS restart and even with admin rights I could not disable them as usual via Task Scheduler.
So I had to take ownership of the:
C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator
and disabled any inherited rights and allow the SYSTEM and the LOCAL SERVICE to read&execute only. Then I was able to rename Reboot task file to Reboot.bak and Schedule Scan to Schedule Scan.bak (these files without extensions have XML format inside and represent the very scheduled tasks).
Can all this tedious stuff (disabling Windows Update and Update Orchestrator services + Reboot and Schedule Scan tasks) be automated somehow?
Yes, it can be automated. However I'm not going to add anything like that in my script and I strongly recommend not to disable Windows Updates altogether.
That being said, you can programatically take ownership using takeown and icacls commands. First, you need to be an administrator (obviously) and then you run something like
takeown /F C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator /A /R
icacls C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator /grant Administrators:F /T
This will grant the Administrators group ownership and full permission to the directory. Check the manual for possible parameters for icacls to see how you can deny R/W for SYSTEM or other users (I have something like that in DisableAutoLogger tweak).
The rest is then a combination of StopService, Set-Service -StartupType Disabled and Disable-ScheduledTask, but that part you probably already figured out.
Thank you! I am now able to disable the scheduled task.
I am still not able to change the usosvc startup type. Getting an access denied error.
set-service : Service 'Update Orchestrator Service (usosvc)' cannot be configured due to the following error: Access is denied
Check out this link
set X=UsoSvc
reg add "HKLM\SYSTEM\CurrentControlSet\Services\%X%" /V "Start" /T REG_DWORD /D "4" /F
Now I am using this automated way for the WU full-control, so far so good:
https://forums.mydigitallife.net/threads/wumt-wrapper-script-controls-windows-update-service.72203/