A T-SQL script is running an xp_cmdshell call to stop a local service through Powershell's Stop-Service, say, like this:
exec xp_cmdshell 'powershell Stop-Service -InputObject (get-Service -Include *"MyService"*)'
Now, since the current login is sysadmin, it is being ran under SQL Server's service's account, which is a local account without admin rights. In that case the Stop-Service fails due to lacking access. Then, if I add the SQL Server's account to Administrators group, the only way I can make this change effective is to restart SQL Server's service. Is there any other way to do this without having to restart the sql server? Thank you!
PS. I know xp_cmdshell is bad for you, let's please not focus on that.