My home internet is of depressing quality, so when Windows initiates downloads without my permission, it makes every device on the network practically unable to use the internet. Disabling the services commonly at fault, Windows Update and Delivery Optimizations, through the Services and Resource Monitor GUIs is a long, multi-staged, and awkward process, so I wished to automate this. I've made the following batch file:
@echo on
:: turning off bandwidth-stealing services
NET stop "Windows Update"
NET stop "Delivery Optimization"
:: disabling those same services
SC config DoSvc start= disabled
SC config wuauserv start= disabled
Although the first two commands (after the @echo on
) have not been tested while the offending services were running, it appears that they will function properly. The other two commands, however, each return the following message when executed:
[SC] OpenService Failed 5:
Access is denied.
Is there a way to get around this or otherwise gain full control over these services, or is there something else wrong with my script?
Answer
Is there a way to get around this or otherwise gain full control over
these services, or is there something else wrong with my script?
You need to run the script as an Administrator.
Access is denied.
This is an indication of the script being run without elevated user rights. Windows by default will start an application at the lowest security setting the user has, to avoid the situation of a user running a malicious application the highest permission possible by default.
The last two lines were the ones not working, and I would have set my
connection as metered but my version of Windows 10 doesn't have that
option.
How to set an Ethernet metered connection on Windows 10. Since the question isn't about how to enable a metered connection I am going to choose not to cite and quote the relevant information.
don't know why Windows wouldn't run it as admin by default
Running anything by default with the highest permission a user has is a horrible idea. Which is the reason Linux and MacOS have sudo.
No comments:
Post a Comment