Jump to content

Disabling services from the command line.


GrAYv3e
 Share

Recommended Posts

Hey everyone,

Sorry about my first post being for help but I didn't have anywhere else to turn to.

Is it possible to disable a windows service from the command line in Windows XP ? If yes, how?

The reason why is: I need to disable multiple services on multiple PCs running Windows XP, and I'd like to create a batch file that does this for me.

Any help would be appreciated.

Link to comment
Share on other sites

http://www.ss64.com/nt/netsvc.html

Can be done over the network too if you have access.

Thanks a lot digip.

Ok, sorry to plague for more help, but is this all i need in the batch file?

sc stop "servicename"  This is to stop the service.

sc config "servicename" start=disabled  And this is to not have it start again, but I'm not sure if this is the correct syntax.

I plan to just copy that a few times for all the services I want to disable.

Link to comment
Share on other sites

start=disabled

Not sure but i think this may be a value of 1, 2, or 3 for disabled, manual and auto, but not sure. Maybe confirm on the Microsoft site for forums, but I think it is an integer value.

Link to comment
Share on other sites

sc <server> config [service name] <option1> <option2>...

CONFIG OPTIONS:

NOTE: The option name includes the equal sign.

type= <own|share|interact|kernel|filesys|rec|adapt>

start= <boot|system|auto|demand|disabled>

error= <normal|severe|critical|ignore>

binPath= <BinaryPathName>

group= <LoadOrderGroup>

tag= <yes|no>

depend= <Dependencies(separated by / (forward slash))>

obj= <AccountName|ObjectName>

DisplayName= <display name>

password= <password>

Link to comment
Share on other sites

start= <boot|system|auto|demand|disabled>

I'm sorry for sounding noobish but that doesn't really clarify much for me? Does that mean that that disable would be "5" so I have to change it to:

sc config "servicename" start=5

Sorry, this is the first time I'm using the command line to do this.

Link to comment
Share on other sites

Yeah, I am seeing a problem with this as well.

As long as the service is set to manual or automatic, you can do a:

sc stop servicename

or

sc start servicename

and this seems to work for stopping and stopping the services, but I noticed that if a service is set to disabled, it gets an error trying to start it. I also do not seme to be able to get it to manually configure it through the command prompt, but you may have to be logged on as administrator for it to take effect or provide a password. Not sure why it doe snto work though.

When following their documentation, I entered: sc config ALG Start=demand

to see if I could set it's startup type, but it does not seem to change anything and I get the prompt of commands for the sc command.

More googling might revealwhat we are doing wrong, or someone else on the forums might know?

Link to comment
Share on other sites

ok. Figured it out.

Its weired but, you have to have a space after the Start=

Syntax:

sc config servicename start= disabled

Must contain the space after the start= or you get an error. Give it a try.

The reason I was syaing it was an iteger was because I know if you use a registry file to mod a service through the registry the values are numbers, not the actual word, but when at a command prompt, you need to type out the whole word, not it's integer value. So you had it right, just needed the space.

Link to comment
Share on other sites

net stop service

Yeah, and then to disable it so it does not start on reboot....

sc servername stop servicename

sc servername config servicename start= <boot|system|auto|demand|disabled>

net start|stop  does not disable the service. After a reboot it would start again if it is set to automatic.

Link to comment
Share on other sites

ok. Figured it out.

Its weired but, you have to have a space after the Start=

Syntax:

sc config servicename start= disabled

Must contain the space after the start= or you get an error. Give it a try.

The reason I was syaing it was an iteger was because I know if you use a registry file to mod a service through the registry the values are numbers, not the actual word, but when at a command prompt, you need to type out the whole word, not it's integer value. So you had it right, just needed the space.

Eek, only missing a space :p

Thanks for the help guys, especially digip.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...