At a larger client I needed an easier way to disable a service on 400+ workstations than manually stopping and disabling the service. Group Policy would have worked but I wanted something quicker. Something that would not require me to reboot or force a Group Policy update to all those workstations. I use PSexec for quite a few things. PSexec is a small application from Sysinternals who is now owned by Microsoft. The application lets you remotely execute commands on workstations and servers. You can also bring up a remote command prompt and do a number of things from there. In this case I wanted to disable and stop a service on all of those workstations. I did this with the following command:
psexec \* sc config browser start= disabled
PSexec is the app that we are using to send the command “sc config browser start= disabled”. \* is stating we want to run this command on all computers in the domain. You could specify a single server/computer with \computername or replace \ with @browser.txt and have file with that name in the same directory you are in via command prompt. The sc is Service Control followed by config which modify the configuration of a specific service. You could use start or stop there to start or stop a service which is the second command that I used. Browser in the command is the service in which we are working with and “start=” is a fixed line in which you need to specify an argument. In this case I used “disabled”. You have the option to do auto, manual or disabled.
Next we need to actually stop the service. This can be done with the following command:
psexec \* sc stop browser
Pretty simple huh. Afterwards I did a few spot checks to verify that it actually worked and then setup a Group Policy for an machines that I was unable to touch with psexec as well as new computers added in the future.
More information on options with SC can be found here. PSexec is part of the PStools suite. I recommend that everyone check this out if you have not in the past. PSinfo can be used for network documentation and PSshutdown can poke a stubborn computer in the eye.