Windows Services Optimizer (WinServicesOptimizer.vbs)
Disabling unnecessary Windows services can result in significant performance gains for production machines and virtual machines. This script helps you manage and share templates for services optmization. Some templates are included
Sample usage scenarios for this script:
- Optimize real machines - make real machines run faster.
- Initial computer build / existing machines - this script works equally well to prepare a machine for imaging, to be run during first boot or to be run on existing machines.
- Optimize virtual machines - virtual machines - especially those used for testing - can be significantly optimized by shutting down unneeded services.
- Home Computers - home machines can be especially burdened with extra services intended to be used in corporate environments for managing many things not present in a home network.
- Services On Demand - turn off or pause unnecessary services when running intensive applications like games. For application specific services, leave them turned off and only turn them on when the software is in use (sample script included).
- System Hardening - create service profiles that disable unneeded services for better system security.
- Detecting New Services - on a regular basis or after a software install.
- Full Featured - most scripts that perform services optimization focus on disabling services (not setting to ANY mode) and generally do not account for being able to undo changes and have multiple configuration files for different purposes.
- Manages both Service Run States and Startup Modes - any specific run of the script can change either or both of these attributes for some or all of your services. This makes it useful for applications such as service startup modes for system optimization or for temporary service disablement (e.g. to play intensive games) or to leave application specific services off until they are actually needed (run script to startup services => start app => app ends => run script to shutdown services)
- Convert BlackViper.com Reg Files - how to document describing very simple procedure to convert BlackViper.com registry files to Service Profiles.
- Multiple Configuration Files - examples "XPSP3_memoryoptimized", "XPSP3_VM_minimal", "XPSP3_defaults", "MyServicesBeforeChanges"
- Unlimited Undo - serialized undo files are produced with each run of the script. The most recent is available with a simple command line switch.
- Save Existing Service Configuration - for building custom templates, to return to a known state or to save service changes made manually in control panel.
- CSV Configuration File Format - easy to edit and compare. Same data fields that would be output by any WMI call.
- Only Managed What You Need To - simply remove services from the configuration file if you aren't managing them or if certain ones should never be disabled or reconfigured.
- Easy of Use - uses full service names from control panel to avoid need to constantly lookup a service's registry name.
- UAC Prompt Handling - If you accidentally run the script without first having admin rights, it automatically prompts for UAC and relaunches itself. Can be disabled for non-interactive runs using "-nouacprompting" which causes the script to generate an error if it does not have admin rights.
- Commenting Files - Configuration files can have comments via records that contain a non valid start mode or run state.
- Quick - use of database objects to read services configuration files allows a single control pass over all services to configure the entire set.
- Logging -basic and verbose logging tell what services were changed, what ones could not be changed (and the full text error message) and what ones were discovered on the machine that were not in the configuration file. To generate a log file, redirect the script output to a file.
- Command Line Switch Validation - validate command line and produce useful error messages.
- Integrated Help - use "/?" or "/help" to receive help.
Included Services Configuration Samples:
- Included Services Profiles - XPSP3 Defaults, XPSP3 Minimal VM, XPSP3 Memory Optimized, Vista Business SP1 Defaults. Additional profiles and contributed profiles will be posted here as they become available.
- Services On Demand Scripts - VMWare Workstation 6 - a) UAC elevation (if needed), b) start 3 VMware services and c) then start VMWare, d) shuts the services down when you are done using VMWare.
- 1.41 (2008/11/18) - added how to file on converting BlackViper services profiles called "aaa how to convert blackviper.com services registry files.txt"
- 1.40 (2008/11/05) - detects admin rights, UAC prompt if not suppressed with "-nouacprompting"
This updated added three new functions for dealing with relaunching a script under UAC and with the correct scripting host. These functions are robust for scripting for Vista UAC and XP RunAs apart from this implementation and may later appear as a seperate script posting.
Function "IsAdmin" uses registry technique to detect admin rights, rather than group enumeration which can be slower and more cumbersome than simply trying to write to a known secure location.
Function "IsScriptHost(HostToCheck)" to check if script host is the desired one (e.g. "cscript.exe")
Function "LaunchScript (DesiredHost, UACPromptIfNeeded, LeaveOpen)" Can relaunch script with UAC or just change script host or both at one time. Does fancy stuff to keep same working folder in relaunched environment and maintains working folder even when not the same drive as the folder containing the script. Works with XP RunAs as well. DOES NOT map network drive letters if you change to a different profile at UAC/RunAs prompt - local letters work fine. Not tested with UNCs.
"UAC_servicesup_runprogram_servicesdown.vbs" - New services on demand sample that uses admin rights detection and UAC prompting.
- 1.35 (2008/11/04) - fixed errors in help and error messages, fix file parsing, handles fully pathed CSVs, added switch "-suppressnotinfilereport", added sample code to distribution named: 'servicesup_runprogram_servicesdown.vbs' to demo how to use the script to temporarily start services.
- 1.31 (2008/10/30) - added record error checking and ability to include file comments, commented included service profiles. CHANGED PARAMETER NAME "servicesfile" to "servicesprofile"
- 1.30 (2008/10/29) - first public version.
Please Submit Your Service Profiles For Inclusion:
If you have a cool or creative services profile to share, please send us a copy. They can be for standard Microsoft services or other popular software (such as disabling Nero's media indexing service).
To report bugs or submit enhancement suggestions, enhanced code or service profiles, please drop me a message at firstname.lastname@example.org