[Batch and VBS] Set all Windows services to default (all supported versions, editions and builds)

Discussion in 'Scripting' started by hearywarlot, Jul 21, 2017.

  1. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    #1 hearywarlot, Jul 21, 2017
    Last edited: Mar 11, 2018
    This is a Batch script which can be used to set all Windows services to the default state.

    It is useful in the case you have a system with messed up services startup configurations and need to repair.
    It will automatically detect your version, edition and build and use a customized configuration for your installation.

    This script also contains some small piece of VBS code to automatically elevate this script as admin.
    It is never extracted, but instead directly run from the script, so no fear of junk files.

    Code:
    RestoreServicesDefault.cmd
    Code:
    <!-- : Begin batch script
    @ECHO OFF
    SETLOCAL ENABLEDELAYEDEXPANSION
    
    FSUTIL dirty query "!SYSTEMDRIVE!" >NUL
    IF not !ERRORLEVEL! equ 0 (
       ECHO(This script will set All Windows services of this installation to their generic defaults^^!
       ECHO(This means any issues from misconfiguring will be fixed, but might also introduce new issues if
       ECHO(a program you have installed needs a Windows service set to automatic or disabled.
       ECHO(
       SET "OhNo="
       SET /P "OhNo=Are you sure you want to set all Windows services to generic default? (Yes/[No]):"
       IF not "!OhNo!"=="Yes" (
           GOTO :END
       )
       ECHO(*************************************
       ECHO(Invoking UAC for Privilege Escalation
       ECHO(*************************************
       CSCRIPT //nologo "%~f0?.wsf" //job:ELAV /File:"%~f0"
       EXIT /B
    )
    
    SET "VERKEY=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
    FOR /f "tokens=4-8" %%A IN ( 'REG QUERY "!VERKEY!" /v ProductName ^| FIND /i ^"ProductName^"' ) do (
       REM # Check for Windows version
       SET "AllowVersion=[7] [8.1] [10]"
       IF not "!AllowVersion:[%%A]=!" == "!AllowVersion!" (
           SET "WinVersion=%%A"
       ) else (
           CALL :ERROR "This script is only compatible with Windows versions: !AllowVersion!"
           GOTO :END
       )
       REM # Check for Windows edition
       FOR %%F in ( "7|[Starter] [HomeBasic] [HomePremium] [Professional] [Ultimate] [Enterprise]" "8.1|[Core] [Pro] [Enterprise]" "10|[Home] [Pro]" ) do (
           FOR /F "delims=| tokens=1-2" %%G in ( "%%~F" ) do (
               IF "%%G" == "!WinVersion!" (
                   SET "AllowPrd=%%H"
                   IF not "!AllowPrd:[%%B%%C%%D%%E]=!" == "!AllowPrd!" (
                       SET "WinProduct="
                       FOR %%I in ( %%B %%C %%D %%E ) do (
                           SET "ShortPrd=%%I"
                           SET "WinProduct=!WinProduct!!ShortPrd:~0,1!"
                       )
                   ) else (
                       CALL :ERROR "To use this script without potential problems, please run only"^
                           "on Windows !WinVersion! editions:"^
                           "!AllowPrd!"
                       GOTO :END
                   )
               )
           )
       )
    )
    REM # Check for Windows build
    FOR /f "tokens=3" %%A IN ( 'REG QUERY "!VERKEY!" /v CurrentBuild ^| FIND /i ^"CurrentBuild^"' ) do (
       SET "AllowBld="
       FOR %%B in ( "7|7601/SP1" "8.1|9600|9600" "10|14393/1607,15063/1703,16299/1709" ) do (
           FOR /F "delims=| tokens=1-2" %%C in ( "%%~B" ) do (
               IF "%%C" == "!WinVersion!" (
                   FOR %%E in ( %%D ) do (
                       FOR /F "delims=/ tokens=1-2" %%F in ( "%%E" ) do (
                           IF %%F equ %%A (
                               SET "WinBuild=%%G"
                           ) else (
                               SET "AllowBld=[%%F] !AllowBld! "
                           )
                       )
                   )
                   IF not defined WinBuild (
                       CALL :ERROR "To use this script without potential problems, please run only"^
                           "on Windows !WinVersion! builds:"^
                           "!AllowBld!"
                       GOTO :END
                   )
               )
           )
       )
    )
    
    REM Cool Powershell 5 command to easily get all services startup state. Take notice though it
    REM it will only ignore "Automatic (Delayed start)" and show simply as "Automatic"...
    REM Get-Service |Select-Object -Property Name,StartType |Sort-Object -Property StartType
    
    REM ## Add services to this list as you see fit.
    REM ## It is possible to add additional Builds and Editions for config, these can be added
    REM  # interchangeable on the third or forth slash.
    REM ## Windows Editions are written with starting letters (eg, S,HB,HP,P, etc), omit
    REM  # the edition to include all editions.
    REM ## Config is checked left to right, so you should Prefix config if targetting all of
    REM  # a Windows Version and suffix when also Editions and/or Builds. If you do not, the
    REM  # all version config will have precedence and config for Edition and Build will never be applied.
    REM ## Incase the service does not exist on specific build and/or edition, replace the
    REM  # State with '-', it will then be ignored for that case.
    REM ## Format = "Service|(State or -)/(Version)/(Build or Edition)/(Build or Edition or 'omit')"
    REM ## Examples = "Example|A/10/P/1709", "Blabla|A/10/1607/H", "MSiSCSI|M/7,M/8.1,M/10"
    REM  # or "AppMgmt|M/7,-/7/S,-/7/HB,-/7/HP,M/8.1,-/8.1/C,M/10,-/10/H"
    
    SET "A=auto"
    SET "L=delayed-auto"
    SET "M=demand"
    SET "D=disabled"
    
    SET DefaultServiceList=^
       "AJRouter|M/10"^
       "ALG|M/7,M/8.1,M/10"^
       "AeLookupSvc|M/7,M/8.1"^
       "AppIDSvc|M/7,M/8.1,M/10"^
       "AppMgmt|M/7,-/7/S,-/7/HB,-/7/HP,M/8.1,-/8.1/C,M/10,-/10/H"^
       "AppReadiness|M/8.1,M/10"^
       "AppVClient|D/10,-/10/H"^
       "AppXSVC|M/8.1,M/10"^
       "Appinfo|M/7,M/8.1,M/10"^
       "AssignedAccessManagerSvc|M/10/1709/P"^
       "AudioEndpointBuilder|A/7,A/8.1,A/10"^
       "AudioSrv|A/7,A/8.1,A/10"^
       "AxInstSV|M/7,M/8.1,M/10"^
       "BDESVC|M/7,M/8.1,M/10"^
       "BFE|A/7,A/8.1,A/10"^
       "BITS|M/7,L/8.1,L/10"^
       "BrokerInfrastructure|A/8.1,A/10"^
       "Browser|M/7,M/8.1,M/10"^
       "BthHFSrv|M/10"^
       "CDPSvc|L/10"^
       "COMSysApp|M/7,M/8.1,M/10"^
       "CertPropSvc|M/7,M/8.1,M/10"^
       "ClipSVC|M/10"^
       "CoreMessagingRegistrar|A/10"^
       "CryptSvc|A/7,A/8.1,A/10"^
       "CscService|A/7,-/7/S,-/7/HB,-/7/HP,M/8.1,-/8.1/C,M/10,-/10/H"^
       "DPS|A/7,A/8.1,A/10"^
       "DcpSvc|M/10/1607"^
       "DcomLaunch|A/7,A/8.1,A/10"^
       "DeviceAssociationService|A/8.1,M/10"^
       "DeviceInstall|M/8.1,M/10"^
       "DevQueryBroker|M/10"^
       "Dhcp|A/7,A/8.1,A/10"^
       "DiagTrack|A/10"^
       "DmEnrollmentSvc|M/10"^
       "Dnscache|A/7,A/8.1,A/10"^
       "DoSvc|L/10,M/10/1709/H"^
       "DsSvc|M/10"^
       "DsmSVC|M/8.1,M/10"^
       "DusmSvc|A/10,-/10/1607"^
       "EFS|M/7,M/8.1,M/10"^
       "EapHost|M/7,M/8.1,M/10"^
       "EntAppSvc|M/10"^
       "EventLog|A/7,A/8.1,A/10"^
       "EventSystem|A/7,A/8.1,A/10"^
       "FDResPub|A/7,M/8.1,M/10"^
       "Fax|M/7,M/8.1,M/10"^
       "FontCache3.0.0.0|M/7,M/10/1709"^
       "FontCache|L/7,A/8.1,A/10"^
       "FrameServer|M/10"^
       "GraphicsPerfSvc|M/10/1709"^
       "HomeGroupListener|M/7,M/8.1,M/10"^
       "HomeGroupProvider|M/7,M/8.1,M/10"^
       "HvHost|M/10"^
       "IEEtwCollectorService|M/8.1"^
       "IKEEXT|M/7,M/8.1,M/10"^
       "IPBusEnum|M/7"^
       "InstallService|M/10/1709"^
       "IpxlatCfgSvc|M/10,-/10/1607"^
       "KeyIso|M/7,M/8.1,M/10"^
       "KtmRm|M/7,M/8.1,M/10"^
       "LSM|A/8.1,A/10"^
       "LanmanServer|A/7,A/8.1,A/10"^
       "LanmanWorkstation|A/7,A/8.1,A/10"^
       "LicenseManager|M/10"^
       "MMCSS|A/7,A/8.1"^
       "MSDTC|M/7,M/8.1,M/10"^
       "MSiSCSI|M/7,M/8.1,M/10"^
       "MapsBroker|L/10"^
       "Mcx2Svc|D/7,-/7/S,-/7/HB"^
       "MpsSvc|A/7,A/8.1,A/10"^
       "NaturalAuthentication|M/10,-/10/1607"^
       "NcaSVC|M/8.1,M/10"^
       "NcbService|M/8.1,M/10"^
       "NcdAutoSetup|M/8.1,M/10"^
       "NetSetupSvc|M/10"^
       "NetTcpPortSharing|D/7,D/8.1,D/10"^
       "Netlogon|M/7,M/8.1,M/10"^
       "Netman|M/7,M/8.1,M/10"^
       "NgcCtnrSvc|M/10"^
       "NgcSvc|M/10"^
       "NlaSvc|A/7,A/8.1,A/10"^
       "PNRPAutoReg|M/7,M/8.1,M/10"^
       "PNRPsvc|M/7,M/8.1,M/10"^
       "PcaSvc|M/7,A/8.1,A/10,M/10/1709"^
       "PeerDistSvc|M/7,-/7/S,-/7/HB,-/7/HP,M/8.1,-/8.1/C,D/10,-/10/H"^
       "PerfHost|M/10"^
       "PhoneSvc|M/10"^
       "PlugPlay|A/7,M/8.1,M/10"^
       "PolicyAgent|M/7,M/8.1,M/10"^
       "Power|A/7,A/8.1,A/10"^
       "PrintNotify|M/8.1,M/10"^
       "ProfSvc|A/7,A/8.1,A/10"^
       "ProtectedStorage|M/7"^
       "PushToInstall|M/10/1709"^
       "QWAVE|M/7,M/8.1,M/10"^
       "RasAuto|M/7,M/8.1,M/10"^
       "RasMan|M/7,M/8.1,M/10,A/10/1709"^
       "RetailDemo|M/10"^
       "RemoteAccess|D/7,D/8.1,D/10"^
       "RemoteRegistry|D/7,D/8.1,D/10"^
       "RmSvc|M/10"^
       "RpcEptMapper|A/7,A/8.1,A/10"^
       "RpcLocator|M/7,M/8.1,M/10"^
       "RpcSs|A/7,A/8.1,A/10"^
       "SCPolicySvc|M/7,M/8.1,M/10"^
       "SCardSvr|M/7,D/8.1,D/10"^
       "SDRSVC|M/7,M/10"^
       "SEMgrSvc|M/10,-/10/1607"^
       "SENS|A/7,A/8.1,A/10"^
       "SNMPTRAP|M/7,M/8.1,M/10"^
       "SSDPSRV|M/7,M/8.1,M/10"^
       "SamSs|A/7,A/8.1,A/10"^
       "ScDeviceEnum|M/8.1,M/10"^
       "Schedule|A/7,A/8.1,A/10"^
       "SecurityHealthService|A/10,-/10/1607"^
       "Sense|M/10,-/10/H"^
       "SensorDataService|M/10"^
       "SensorService|M/10"^
       "SensrSvc|M/7,-/7/S,M/8.1,M/10"^
       "SessionEnv|M/7,M/8.1,M/10"^
       "SharedAccess|D/7,D/8.1,M/10"^
       "SharedRealitySvc|M/10/1709"^
       "ShellHWDetection|A/7,A/8.1,A/10"^
       "SmsRouter|M/10"^
       "Spooler|A/7,A/8.1,A/10"^
       "SstpSvc|M/7,M/8.1,M/10"^
       "StateRepository|M/10"^
       "StiSvc|M/7,M/8.1,M/10"^
       "StorSvc|M/7/P,M/7/E,M/8.1,M/10"^
       "SysMain|A/7,A/8.1,A/10"^
       "SystemEventsBroker|A/8.1,A/10"^
       "TBS|M/7"^
       "THREADORDER|M/7,M/8.1"^
       "TabletInputService|M/7,M/8.1,M/10"^
       "TapiSrv|M/7,M/8.1,M/10"^
       "TermService|M/7,M/8.1,M/10"^
       "Themes|A/7,A/8.1,A/10"^
       "TieringEngineService|M/10"^
       "TimeBroker|M/8.1"^
       "TimeBrokerSvc|M/10"^
       "TokenBroker|M/10/1709"^
       "TrkWks|A/7,A/8.1,A/10"^
       "TrustedInstaller|M/7,M/8.1,M/10"^
       "UI0Detect|M/7,M/8.1,M/10"^
       "UevAgentService|D/10,-/10/H"^
       "UmRdpService|M/7,-/7/S,-/7/HB,-/7/HP,M/8.1,M/10"^
       "UserManager|A/10"^
       "UsoSvc|M/10"^
       "UxSms|A/7"^
       "VSS|M/8.1,M/10"^
       "VaultSvc|M/7,M/8.1,M/10"^
       "WarpJITSvc|M/10/1709"^
       "W32Time|M/7,M/8.1,M/10"^
       "WEPHOSTSVC|M/8.1,M/10"^
       "WFDSConSvc|M/10,-/10/1607"^
       "WMPNetworkSvc|M/7,M/8.1,M/10"^
       "WPCSvc|M/7,M/8.1"^
       "WPDBusEnum|M/7,M/8.1,M/10"^
       "WSService|M/8.1"^
       "WSearch|L/7,L/8.1,L/10"^
       "WalletService|M/10"^
       "WbioSrvc|M/7,M/8.1,M/10"^
       "Wcmsvc|A/8.1,A/10"^
       "WcsPlugInService|M/7,M/8.1"^
       "WdNisSvc|M/8.1,M/10"^
       "WdiServiceHost|M/7,M/8.1,M/10"^
       "WdiSystemHost|M/7,M/8.1,M/10"^
       "WebClient|M/7,M/8.1,M/10"^
       "Wecsvc|M/7,M/8.1,M/10"^
       "WerSvc|M/7,M/8.1,M/10"^
       "WiaRpc|M/8.1,M/10"^
       "WinDefend|L/7,A/8.1,A/10"^
       "WinHttpAutoProxySvc|M/7,M/8.1,M/10"^
       "WinRM|M/7,M/8.1,M/10"^
       "Winmgmt|A/7,A/8.1,A/10"^
       "WlanSvc|A/7,A/8.1,A/10"^
       "WpnService|A/10"^
       "WwanSvc|M/7,M/8.1,M/10"^
       "XblAuthManager|M/10"^
       "XblGameSave|M/10"^
       "XboxGipSvc|M/10,-/10/1607"^
       "XboxNetApiSvc|M/10"^
       "bthserv|M/7,M/8.1,M/10"^
       "camsvc|M/10/1709"^
       "defragsvc|M/7,M/8.1,M/10,D/10/1703"^
       "diagnosticshub.standardcollector.service|M/10"^
       "diagsvc|M/10/1709"^
       "dmwappushservice|M/10"^
       "dot3svc|M/7,M/8.1,M/10"^
       "ehRecvr|M/7,-/7/S,-/7/HB"^
       "ehSched|M/7,-/7/S,-/7/HB"^
       "embeddedmode|M/10"^
       "fdPHost|M/7,M/8.1,M/10"^
       "fhsvc|M/8.1,M/10"^
       "gpsvc|A/7,A/8.1,A/10"^
       "hidserv|M/7,M/8.1,M/10"^
       "hkmsvc|M/7,M/8.1"^
       "icssvc|M/10"^
       "idsvc|M/7"^
       "iphlpsvc|A/7,A/8.1,A/10"^
       "irmon|M/10"^
       "lfsvc|M/8.1,M/10"^
       "lltdsvc|M/7,M/8.1,M/10"^
       "lmhosts|A/7,A/8.1,M/10"^
       "msiserver|M/8.1,M/10"^
       "napagent|M/7,M/8.1"^
       "netprofm|M/7,M/8.1,M/10"^
       "nsi|A/7,A/8.1,A/10"^
       "p2pimsvc|M/7,M/8.1,M/10"^
       "p2psvc|M/7,M/8.1,M/10"^
       "pla|M/7,M/8.1,M/10"^
       "seclogon|M/7,M/8.1,M/10"^
       "shpamsvc|D/10"^
       "smphost|M/8.1,M/10"^
       "spectrum|M/10/1709"^
       "sppsvc|L/7,L/8.1,L/10"^
       "sppuinotify|M/7"^
       "svsvc|M/8.1,M/10"^
       "swprv|M/7,M/8.1,M/10"^
       "tiledatamodelsvc|A/10,M/10/1709"^
       "tzautoupdate|D/10"^
       "upnphost|M/7,M/8.1,M/10"^
       "vds|M/7,M/8.1,M/10"^
       "vmicguestinterface|M/8.1,M/10"^
       "vmicheartbeat|M/8.1,M/10"^
       "vmickvpexchange|M/8.1,M/10"^
       "vmicrdv|M/8.1,M/10"^
       "vmicshutdown|M/8.1,M/10"^
       "vmictimesync|M/8.1"^
       "vmicvmsession|M/10"^
       "vmicvss|M/8.1,M/10"^
       "wbengine|M/7,M/8.1,M/10"^
       "wcncsvc|M/7,M/8.1,M/10"^
       "wercplsupport|M/7,M/8.1,M/10"^
       "wisvc|M/10"^
       "wlidsvc|M/8.1,M/10"^
       "wlpasvc|M/10,-/10/1607"^
       "wmiApSrv|M/7,M/8.1,M/10"^
       "workfolderssvc|M/8.1,M/10"^
       "wscsvc|L/7,L/8.1,L/10"^
       "wuauserv|L/7,M/8.1,M/10"^
       "wudfsvc|M/7,M/8.1"^
       "xbgm|M/10/1709"
    
    REM ## For those wanting easier to read version of above list, uncomment (delete "REM #") below 2 commands to
    REM ## make script generate easier to read service list
    REM #CALL :GenEasierToReadList DefaultServiceList
    REM #GOTO :END
    
    SET "State="
    FOR %%A in ( !DefaultServiceList! ) do (
       FOR /F "delims=| tokens=1-2" %%B in ( "%%~A" ) do (
           SET "Service=%%B"
           FOR %%D in ( %%C ) do (
               FOR /F "delims=/ tokens=1-4" %%E in ( "%%D" ) do (
                   REM # Verify list integrity
                   SET "AllowState=A,L,M,D,-"
                   IF "!AllowState:%%E=!" == "!AllowState!" (
                       CALL :ERROR "ERROR: Mistake in Default list at State '%%E' for service '!Service!'"
                   ) else (
                       IF "!AllowVersion:[%%F]=!" == "!AllowVersion!" (
                           CALL :ERROR "ERROR: Mistake in Default list at Windows version '%%F' for service '!Service!'"
                       ) else (
                           REM # Verify Windows version for service setting
                           IF "%%F" == "!WinVersion!" (
                               IF "%%G" == "" (
                                   SET "State=!%%E!"
                               ) else (
                                   REM # Verify Windows edition and/or build in both "%%G" and "%%H" for service setting
                                   REM # If "%%E" contains a "-" and service setting matches with the current Windows, will ignore this service setting
                                   SET "AllowSumthg=/!WinProduct!/!WinBuild!/"
                                   IF not "!AllowSumthg:/%%G/=!" == "!AllowSumthg!" (
                                       IF "%%H" == "" (
                                           IF "%%E" == "-" (
                                              SET "State="
                                           ) else (
                                               SET "State=!%%E!"
                                           )
                                       ) else (
                                           IF not "!AllowSumthg:/%%H/=!" == "!AllowSumthg!" (
                                               IF "%%E" == "-" (
                                                   SET "State="
                                               ) else (
                                                   SET "State=!%%E!"
                                               )
                                           )
                                       )
                                   )
                               )
                           )
                       )
                   )
               )
           )
       )
       IF defined State (
           ECHO( Setting !Service! to "!State!"
           SC config "!Service!"  start= !State!
           IF not !ERRORLEVEL! equ 0 (
               SET "ercFailSVC=!ERRORLEVEL!"
               SET /a "cntFailSVC+=1"
               SET "nameFailSVC!cntFailSVC!=!Service!"
               SET "ercFailSVC!cntFailSVC!=!ercFailSVC!"
           )
           SET "State="
           ECHO(
       )
    )
    
    IF defined ercFailSVC (
       COLOR 4f
       FOR /L %%A in (1,1,!cntFailSVC!) Do (
           IF !ercFailSVC%%A! equ 5 (
               SET "SVCerc5=%%A !SVCerc5!"
           ) else (
               IF !ercFailSVC%%A! equ 1060 (
                   SET "SVCerc1060=%%A !SVCerc1060!"
               ) else (
                   IF !ercFailSVC%%A! equ 0 (
                       ECHO(Errorcode: !ercFailSVC%%A!
                       ECHO(Service: !setFailSVC%%A!
                       ECHO(
                   )
               )
           )
       )
       IF defined SVCerc5 (
           ECHO(
           ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
           FOR %%A in ( !SVCerc5! ) do (
               ECHO(!nameFailSVC%%A!
           )
           ECHO(
           ECHO(Errorcode: 5
           ECHO(This error means you do not have the required permission to modify the state of this service
           ECHO(This usually also means this might be a essential service
           ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
       )
       IF defined SVCerc1060 (
           ECHO(
           ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
           FOR %%A in ( !SVCerc1060! ) do (
               ECHO(!nameFailSVC%%A!
           )
           ECHO(
           ECHO(Errorcode: 1060
           ECHO(This error means this service does not exist on your installation
           ECHO(This might also mean this service was removed, does not apply to your system or mispelled in this script
           ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
       )
       ECHO(
       ECHO(A number of !cntFailSVC! services have failed to be set.
       ECHO(The above have failed.
    )
    
    ECHO(
    ECHO(Operation Finished
    ECHO(
    ECHO(Usually this script should set "Wlan Autoconfig" service to automatic, if your device is not a laptop or
    ECHO(has no wireless capabilities, you might then want to set it to Manual for slight boot speed increase.
    ECHO(
    ECHO(
    ECHO(Written and maintained by Hearlywarlot
    ECHO(Credits to BlackViper.com and batcmd.com for most of their Service Configurations
    ECHO(For updates on the script or other nice things visit our awesome Forum at:
    ECHO(forums.mydigitallife.net/threads/74762/
    ECHO(
    PAUSE
    :END
    COLOR
    ENDLOCAL
    EXIT /B
    
    :GenEasierToReadList
    ( FOR %%A in ( !%1! ) do (
       FOR /F "delims=| tokens=1-2" %%B in ( "%%~A" ) do (
           SET "Service=%%B"
           FOR %%D in ( %%C ) do (
               FOR /F "delims=/ tokens=1-4" %%E in ( "%%D" ) do (
                   IF not "%%E" == "-" (
                       IF not "!PrevService!" == "%%B" (
                           Set "PrevService=%%B"
                           ECHO(Service:%%B
                       )
                       ECHO( State:!%%E!
                       ECHO(  Windows %%F %%G %%H
                   ) else (
                       ECHO(Does not exist on Windows %%F %%G %%H
                   )
               )
           )
       )
       ECHO(
    ) )
    PAUSE
    GOTO :END
    
    :ERROR
    COLOR 4f
    ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    :ERRLOOP
    IF not "%~1"=="" (
       ECHO(%~1
       SHIFT /1
       GOTO :ERRLOOP
    )
    ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    PAUSE
    COLOR
    EXIT /B
    
    ----- Begin wsf script --->
    <package>
       <job id="ELAV">
           <script language="VBScript">
               With Wscript
                   Set strArg = .Arguments.Named
                   If Not strArg.Exists("File") Then
                       .Echo "Switch /File:<File> is missing."
                       .Quit 1
                   End If
               End With
               CreateObject("Shell.Application").ShellExecute strArg("File"), ELAV, "", "runas", 1
           </script>
       </job>
    </package>

    Changelog:
    • Added warning so user knows resetting services to generic defaults might cause issues in rare cases.
    • Made code in script slightly easier to read and added some more code explanations.
    • Made the services list more complete by adding services from 1703 and 1709 and fixed some mistakes.
    • Removed service settings from unsupported Windows versions (eg, Windows 10 1511).
    • Added code so you can optionally generate a easier to read version of the services list.
    Deleted a unused function I forgot to remove.
    Slight change to Windows edition and build service split check code to make logic more easily to read and use.
    • Slight change to Windows edition and builds check code to make it easier to be lazy add stuff and make code feel cleaner.
    • Added some extra help text to errorcode 1060 info string.
    First release of script.

    Note that while I have checked to make sure that nothing breaks, I can not make guarentees, so use at your own risk.
    If anything breaks because of a wrong service config, please report back so I can fix that :).

    Credits to BlackViper.com for his service configurations which helped me save lots of time for testing.
    I will update as I find more Windows services I may have forgotten.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    Hi hearywarlot, your script seem good congrats for your contribution, I think that this script realy is useful for those users that think disabling several services Windows O.S. stay more "faster" acording several websites ;):)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    Sorry for the n00b question but is this "Batch" a .cmd file with vbs script?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    #4 hearywarlot, Jul 21, 2017
    Last edited: Jul 21, 2017
    (OP)
    Um.. yes, it does.
    I am so used to adding that piece of code that I forgot to put this in the post and title...
    It is used to automatically elevate the script to admin.

    I also edited out the VBS code where it tries to query to winmgmts, incase this service was disabled, making VBS potentially fail.


    Btw, It's (Visual Basic Script), not (Visual Basic Script Script) ;).
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    Visual Basic Bcript Script :eek: only kidding :p
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    #6 hearywarlot, Jul 21, 2017
    Last edited: Jul 21, 2017
    (OP)
    Oh my, it seems in the little time I had to edit and post, I not only made a spelling mistake, but also broke the VBS code...
    Anyway, all fixed now :).

    Who knows, maybe somewhere we might have a B Script language somewhere.

    Edit: Oh there is, nvm then.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Tiger-1

    Tiger-1 MDL Guru

    Oct 18, 2014
    7,897
    10,733
    240
    no issues dude, your application is very useful :D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,962
    904
    60
    Yeah just came back from the ATM machine! ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. cdavisdeco

    cdavisdeco MDL Senior Member

    Jul 8, 2015
    330
    63
    10
    Don't they? :D
     
  10. TairikuOkami

    TairikuOkami MDL Expert

    Mar 15, 2014
    1,172
    1,052
    60
    They do, but some people will always doubt it. As for default Windows setup, its slowness makes me vomit, until I apply my tweaks. :cool:

    http://servicedefaults.com/10
     
  11. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    #11 hearywarlot, Jul 22, 2017
    Last edited: Jul 22, 2017
    (OP)
    They are not wrong, because if your system is unusable and has no network connection, it will probably stay speedy (except you will hate yourself).
    Don't forget to also disable all your external ports (USB, PS2, etc), that way it will keep this state, forever.

    While your at it, follow all of ThioJoe tutorials, so you too can double your computer speed and quadruple your internet speed for free without doing anything!

    PS: Don't follow these steps if you don't want to bring yourself trouble.


    Btw, should I also add XP SP3 and Vista SP2 to this list?
    I was wondering even though these are quite the fossil software's, maybe I could do for history purposes.

    Although, not adding these two might also someday encourage people to upgrade to something which is supported.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. cdavisdeco

    cdavisdeco MDL Senior Member

    Jul 8, 2015
    330
    63
    10
    You're making fun out of this, right? :D
     
  13. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    Nahhhh, I am only trying part some useful wisdom to these poor humans, True Story :angel_not::evil:.

    Here you can find how to get a Netflix for free.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. cdavisdeco

    cdavisdeco MDL Senior Member

    Jul 8, 2015
    330
    63
    10
    @hearywarlot
    Everything is fine as long as your intentions are right. :)
     
  15. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    Ofcourse, if your definition of 'right intention' is to make sure people learn not to follow stupid steps.

    Anyway, what are your thoughts on..
    Good idea or waste of time?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. KNARZ

    KNARZ MDL Addicted

    Oct 9, 2012
    895
    482
    30
    waste.
    and i will take a deeper look in this script as you're using methodes i didn't use yet.
     
  17. cdavisdeco

    cdavisdeco MDL Senior Member

    Jul 8, 2015
    330
    63
    10
    I think it's a waste of time.
     
  18. Roscon

    Roscon MDL Novice

    Jul 15, 2017
    20
    15
    0
    All Windows sc (services) commands (7 - 10):
    Code:
    https://gist.github.com/CHEF-KOCH/6ba8c1e9fa4571bc692b
    worth checking them with your script
     
  19. hearywarlot

    hearywarlot MDL Member

    Jul 31, 2015
    112
    153
    10
    Added some changes that cleans up some work and makes it easier for me to add new things in the future:
    • Added warning so user knows resetting services to generic defaults might cause issues in rare cases.
    • Made code in script slightly easier to read and added some more code explanations.
    • Made the services list more complete by adding services from 1703 and 1709 and fixed some mistakes.
    • Removed service settings from unsupported Windows versions (eg, Windows 10 1511).
    • Added code so you can optionally generate a easier to read version of the services list.
    Thanks for trying to help, but that list is unusable for me since my list was made to bring your systems services to the defaults of it's Windows version, edition and build, this list is too generic for me.
    Some services which existed in Windows 7 no longer exist in 10 or 8.1 or still in 8.1 or service like TokenBroker in 8.1 I could not find in 10, but did find a new TokenbrokerSvc, the state of a service changed from Manual to Automatic or Disabled, etc.

    So this way I try make a as hassle free one click solution for all currently supported Windows releases that will apply specific configs for the exact Windows installation that it runs on.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...