Disable service with access denied

Hi all, I would like to create a script to stop and disable some services with the usual one-liner Stop-Service $serviceName.Name -StartupType Disabled. The issue is that on some cases i get the error “Service ‘Software Protection (sppsvc)’ cannot be configured due to the following error: Access is denied”.

I made some research but couldn’t solve this. Any help appreciated. This script will be used for automation for a lot of servers so any unified solution would be great.

Thank you.

welcome to the forums.

Most of time when your computer says “Access denied” it is right about that. :wink: … But wihtout more information we can actually just take guesses.

What’s the difference between servers where it works and those where it does not?

Hi Olaf thank you for your email.
The thing is that i have servers that are needed to function as windows machines, so no windows server roles are required or anything similar. In that sense i do not need a lot of the services in place.
For example service “Software Protection (sppsvc)” might not be needed for my case but i get the access denied error even when run through an escalated powershell window.
Thank you.

Hmmm … I meant that this is actually not a PowerShell issue. If you’re not allowed to change the start type of the service or to stop the service in the GUI you cannot change these thing with PowerShell.

Regardless of that - the “Microsoft Software Protection Platform Service” is not a service only on Windows Server. It comes with Windows 10 as well.

You should not disable Microsoft Services without a good reason.


Hello Olaf,
I get your point and I must say I agree to keep the stability of the OS. The SPP service was maybe a bad example. Consider e.g. Touch Keyboard and Handwriting Panel Service which triggers a lot as a background service and is practically useless in my case. I am not sure whether disabling this service (which currently cannot be disabled due to access denied issues) will trigger stability errors as well.
Nevertheless i think I got my answer and will try to apply even harder filter on which Windows services to be disabled.
Thank you PS team :slight_smile: