services in xp

Discussion in 'Software' started by j.., Mar 1, 2008.

  1. j..

    j.. Private E-2

    hi guys
    ok, so i'm reinstalling my computer and turning on services etc, but this is really boring so i thought i'd make a batch that sets up the services and other tweaks as i want them.. so i have a couple of questions

    1. ideally i'd like to set up a new hardware profile with only the services i want enables, however i've looked around and there seems to be no way of doing this from a script.. is this correct, that it's not possible to set up a hardware profile from a script?

    2. so if this isn't possible i can always disable the services with sc or a .reg file but as these are the "global" settings the question is what happens when i fsck up and disable the wrong services.. when xp boots in safe mode are the services started dependent on the "global" settings? what i mean is if i disable all the services msconfig obviously it won't boot in normal mode, however will it boot in safe mode (does safe mode ignore what i have disabled/enabled in normal boot)?

    3. has somebody already made a script like this (script and or .reg file is what i'm looking for as i can then easily see exactly what is done)?

    thanks
    j
     
  2. j..

    j.. Private E-2

    thanks but i'm trying to achieve that but by scripting and/or installing .reg files, not hand editing everything :)

    j
     
  3. j..

    j.. Private E-2

    FYI

    regarding my question nr 2:
    some poking around turns out that safe mode seems to work as a hardware profile with regards to services so the answer seems to be, no safe mode won't start a service that you have disabled in the "global" settings..

    i found this page http://inetexplorer.mvps.org/data/safe_mode.htm and checking my registry i see that DcomLaunch (DCOM Server Process Launcher) is in the "minimal" key.. now if i i disable it in the global settings and then reboot into safe mode it isn't started.. as further proof if i put it on automatic and reboot into safe mode it's started (which isn't the case for the services on automatic that aren't in the "minimal" key, they remain on automatic but aren't started)..

    however from the recovery console there is the "enable command" (http://support.microsoft.com/kb/314058) as in enable DcomLaunch SERVICE_AUTO_START, this will put the DcomLaunch on automatic and hence it will be started when i reboot in safe or normal mode..

    so the solution seems to be create an minimal script which simply puts all the services under the "minimal" key to SERVICE_AUTO_START and put that file in %SystemRoot% in case of emergency.. then control the services with a script with sc "globally", if i fsck it up and disable one service too many, boot into recovery console, execute the minimal script (thus putting all the necessary services on autostart), reboot into safe mode and then sort things out from there..

    j
     
  4. j..

    j.. Private E-2

    ok for those that care.. i did a perl script which scans installed services and some info about them, i wget some additional info on some of the services from a site and put that as static info in the perl script.. so what the script does is output a .bat file to std out that you can then edit (change startup type) for each service and then run the .bat file..
    the output looks like this for each service (descriptions truncated):
    REM =====================================================
    REM DISPLAY_NAME: Automatic Updates
    REM SERVICE_NAME: wuauserv
    REM DEPENDENCIES:
    REM DESCRIPTION: Enables the download and installation of Windows [snip]
    REM EXTRA DESC: Used to check up to see if [snip]
    REM DEFAULT: auto
    REM CURR START: auto
    REM VALUES POSS: auto (i.e. automatic)/demand (i.e. manual)/disabled
    REM -------------------------------------------------------
    sc config "wuauserv" start= auto

    so you get some info about the service to help you make a decision on how you want it to start, the only line that actually does something is the "sc config" one, you change the start type (be careful to leave the spaces as they are)..

    for those that don't read perl the script will propose a start type for each service, per default it's the start type the service had when the .bat was created, if the script couldn't find it's start type it will propose the static default value, if that doesn't exist either it will propose automatic..

    if you don't have perl and want to run the script use cygwin or maybe activeperl.com (i have never used it so i don't know anything about it).. i've attached the perl script and a generated example batch file..

    have fun
    j
     

    Attached Files:

  5. j..

    j.. Private E-2

    and of course it turns out that sc doesn't enumerate all the services (at least i can't get it to) so i had to do an ugly hack and instead scan all the keys in HKLM\SYSTEM\CurrentControlSet\Services for services.. now this is just my guesstimate but the key that seems to be present in all the the services keys and never in the driver keys is "ObjectName" so my new script is based on this assumption.. otherwise it works the same..

    j
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds