Disables all services configured as manual start. Among other things, this prevents Power Users from being able to start these services.

Similar documents
Overview. Program Start VB SCRIPT SIGNER. IT Services

GO Software Pty Limited Map: 27 Tacoma Blvd, Pasadena SA 5042 ABN: ACN: How to Export a Self Signed Server Certificate

Associating Run As Accounts in Operations Manager 2007

'Attribute_value = objarguments(0) 'String representing the secedit attribute to test

How to detect the CPU and OS Architecture

Deploying Dell Open Manage Server Administrator from IT Assistant 7.0

Microsoft System Center Configuration Manager Dell Factory Integration

How to save money on Oracle Java Client Licenses

Microsoft System Center Configuration Manager 2012 Dell Factory Integration


Unified Write Filter Configuration

Compact Disc 1. Send us your feedback «Previous Next» Microsoft Windows 2000 Scripting Guide

Lenovo BIOS Windows Management Instrumentation Interface Deployment Guide for Desktop. Date:Sep. 2011

Error Code. GO Software Pty Limited Map: 27 Tacoma Blvd, Pasadena SA 5042 ABN: ACN:

MODEMSHARE MILLENNIUM USER GUIDE

Putting It All Together: Your First WMI/ADSI Script

Leveraging Microsoft System Center Configuration Manager 2007 for Dell Factory Customization

PrimalScript. Your First 20 Minutes. Your First 20 Minutes. Start here to be productive with PrimalScript in just 20 minutes.

Putting It All Together: Your First WMI/ADSI Script

Dell OpenManage Essentials v1.1 Supporting Dell Client Devices

APPLICATION NOTE. Changing Linux and Windows Autostart File MCS-TOUCHSCREENS

Non-SAP Monitoring using OS scripts for multiple metrics

Dell OpenManage Essentials v2.0 Support for Dell Client Devices

Immotec Systems, Inc. SQL Server 2008 Installation Document

Integrating Microsoft System Center Configuration Manager 2007 Operating System Deployment (ConfigMgr OSD) in the Dell Factory

'Get the old path from the registry value we write using this script stroldpath = GetOldPath()

{ WSH VBScript REFERENCE }

JUN / 04 VERSION 7.1 FOUNDATION

Immotec Systems, Inc. SQL Server 2008 Installation Document

Aventail Connect Tunnel Service

Chapter 8: Implementing and Managing Printers

-Ctrust the server certificate This switch is used by the client to configure it to implicitly trust the server

SAS Installation Instructions Windows 2003, XP, 2000, NT. Workstation Installation Guidelines

Installation & Configuration Guide Version 1.4

00:33 Network Loses Connection. 00:30 Health Check. Sweep all files in the monitored folder regardless of when deposited (i.e., process ALL files).

Covers PowerShell v2 APPENDIXES SECOND EDITION. Bruce Payette MANNING

Estuary Model MatLab Compiler Runtime for PCs

Preface 1. Main Management System 2. Contact Information 3 SIPLUS CMS. SIPLUS CMS4000 X-Tools - User Manual Main Management System.

wmi Cookbook Introduction Examples List all running processes

The modusgate console is composed of five configuration modules, these are described in the following table:

IP e-learning Course Manual

Adding your IMAP Mail Account in Outlook 2013 on Windows

Netwrix Auditor. Virtual Appliance and Cloud Deployment Guide. Version: /25/2017

Documentation. nfront AD Disabler. Version Never worry about dormant accounts again nfront Security. All Rights Reserved.

PROMISE ARRAY MANAGEMENT ( PAM) FOR FastTrak S150 TX2plus, S150 TX4 and TX4000. User Manual. Version 1.3

CONNECTING TO YOUR VIRTUAL MACHINE 2 CHANGING YOUR NETWORK PASSWORD 7 ADDITIONAL RESOURCES 8

WorldShip Install on a Single or Workgroup Workstation

Strike View 7.0 SERVER CLIENT SIMULATOR USER S GUIDE

WINDOWS NT 4.0 USER GUIDE

Vodacom One Net app Quick Start Guide For Mac

AUTOMATED APPOINTMENT REMINDER AND ANNOUNCEMENT SYSTEM

UPS WorldShip Upgrade on a Single Workstation or a Workgroup Admin

Outlook 2010 Setup Guide (POP3 Transmailaccess)

Munis. Using Munis Scheduler Version For more information, visit

Installation & Configuration Guide Version 1.3

AutoCount Server. A c c o u n t B i l l i n g S t o c k P O S P a y r o l l. ISV/Software Solutions

GIGABYTE Remote Management Console User s Guide. Version: 1.0

Syn-Apps Desktop Notification Client for Windows Operating Systems User Manual Version Syn-Apps LLC

Windows NT 4.x. Preliminary Steps. Quick CD-ROM Install Steps. Phaser 6250 Color Laser Printer

ManagerTM Mission Falls Court Fremont, CA an ISO 9001 certified company PHONE (510) FAX (510)

Installation & Configuration Guide Version 1.3

Wireless Presentation System User s Manual

Java Trojan UDURRANI UDURRANI

Integrated Software Series Installation Instructions

Sleep Control for MediaPortal

This guide will hopefully explain how Evolution works and what you need to do to get the system installed and configured.

Desktop VirtualPBX Softphone Setup Instructions for Mac

Safety Storm Interactive Participant Guide

Vodafone One Net app Quick Start Guide For PC

Connect the PC and Log into the GUI

Connect the PC and Log into the GUI

The name of this chapter is Dealing with Devices, but of

Step by Step DHCP Server Installation & configuration on Microsoft Windows Server 2016

Instructions for using Citrix to access applications for students in the Department of Mathematics and Statistics.

Connect the PC and Log into the GUI

CELLTRAQ Battery Monitoring Software

EasySMS Office Introduction and Installation

Talk Light Time Manager User Instructions

Smart Data Link with KM Switch. User Manual MD-KM-PIP

Vodafone One Net app Quick Start Guide For PC

IceWarp to IceWarp Migration Guide

Installing HostExplorer 10 For the PC Author: Byron Watanabe

A Comprehensive Look at Foxtrot s Action Library

UPS WorldShip Install on a Workgroup Remote

GO Software Pty Limited Map: 27 Tacoma Blvd, Pasadena SA 5042 ABN: ACN:

SysManSMS Server. with. TAC Xenta-731

Fast Ethernet Print Server 1 Parallel, 2 USB

The Voxco System. About Voxco Accessing Voxco Logging into Voxco Using Voxco Taking a Break Between Calls...

Baan OpenWorld Broker 2.1. Installation Guide for Baan OpenWorld Broker 2.1

VersaBlue User Manual

WorldShip Upgrade on a Single or Workgroup Workstation

First, some hints to Prac 3.Task 3.2

UCON-IP-NEO Operation Web Interface

MonitorPack Guard deployment

I m InTouch Installation Guide for the DSL/Cable environment with a Linksys router Models: BEFSRU31, BEFSR41 V.2, BEFSR11

Wireless Presentation Adaptor User s Manual

BitDefender Enterprise Manager. Startup guide

User Guide Release 6.5.1, v. 1.0

Structuring of the Windows Operating System

Configuring and Monitoring Microsoft Applications

Transcription:

GO Software Pty Limited Map: 27 Tacoma Blvd, Pasadena SA 5042 Phn: 0403-063-991 Fax: none ABN: 54-008-044-906 ACN: 008-044-906 Eml: support@gosoftware.com.au Web: www.gosoftware.com.au VBScript Scripts to Manage Services Changing a Service Account Password Configuring Service Error Control Codes Configuring Service Start Options Determining Services that can be Paused Determining Services Running in All Processes Determining Services Running in a Process Determining Services that can be Stopped Enumerating Antecedent Services for a Single Service Enumerating Dependent Services for All Services Enumerating Dependent Services for a Single Service Enumerating Inactive Services Enumerating Service Load Order Groups Installing a Service Monitoring Service Performance Pausing Services Running Under a Specific Account Removing a Service Resuming AutoStart Services that are Paused Retrieving Service Properties Retrieving Service Status Retrieving Service Status Changes from Event Logs Starting AutoStart Services that have Stopped Starting a Service and Its Dependents Stopping a Service and Its Dependents Stopping Services Running Under a Specific Account Switching Service Accounts to Local Service Changing a Service Account Password Changes the service account password for any services running under the hypothetical service account Netsvc. WinObj="winmgmts:{impersonationLevel=impersonate}!\\" & strcomputer & "\root\cimv2" Set objwmiservice=getobject(winobj) For Each objservice in colservicelist If objservice.startname=".\netsvc" Then errreturn=objservice.change(,,,,,,, "password") Configuring Service Error Control Codes Configures all auto-start services to issue an alert if the service fails during startup. Const NORMAL ERROR CONTROL=2 SQL="Select * from Win32 Service where ErrorControl='Ignore'" errreturn=objservice.change(,,, NORMAL ERROR CONTROL) Configuring Service Start Options Disables all services configured as manual start. Among other things, this prevents Power Users from being able to start these services. SQL="Select * from Win32 Service where StartMode='Manual'" errreturncode=objservice.change(,,,, "Disabled") Determining Services that can be Paused Returns a list of services that can be stopped. SQL="Select * from Win32 Service Where AcceptPause=True" Determining Services Running in All Processes Returns a list of processes and all the services currently running in each process. set objiddictionary=createobject("scripting.dictionary") SQL="Select * from Win32 Service Where State <> 'Stopped'"

If objiddictionary.exists(objservice.processid) Then Else objiddictionary.add objservice.processid, objservice.processid colprocessids=objiddictionary.items For i=0 to objiddictionary.count - 1 SQL="Select * from Win32 Service Where ProcessID='" & colprocessids(i) & "'" Wscript.Echo "Process ID: " & colprocessids(i) Wscript.Echo VbTab & objservice.displayname Set objwmiservice= GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strcomputer & "\root\cimv2") SQL="Associators of {Win32 Service.Name='rasman'} Where AssocClass=Win32 DependentService Role=Antecedent" Determining Services Running in a Process Returns a list of services running in the Services.exe process. If objservice.pathname="c:\windows\system32\services.exe" Then Determining Services that can be Stopped Returns a list of services that can be stopped. SQL="Select * from Win32 Service Where AcceptStop=True" Enumerating Antecedent Services for a Single Service Enumerates all the services that must be running before the SMTP service can be started. SQL="Associators of {Win32 service.name='smtpsvc'} Where AssocClass=Win32 DependentService Role=Dependent" Enumerating Dependent Services for All Services Returns a list of all the services installed on a computer that are currently stopped. Const ForAppending=8 Set objfso=createobject("scripting.filesystemobject") Set objlogfile=objfso.opentextfile("c:\scripts\service dependencies.csv", ForAppending, True) objlogfile.write("service Dependencies") For Each objservice in collistofservices objserviceregistryname=objservice.name objservicedisplayname=objservice.displayname SQL="Associators of {Win32 Service.Name='" & objserviceregistryname & "'} " SQL=SQL & "Where AssocClass=Win32 DependentService Role=Antecedent" If colservicelist.count=0 then objlogfile.write(objservicedisplayname) & ", None" Else For Each objdependentservice in colservicelist objlogfile.write(objservicedisplayname) & ", " objlogfile.write(objdependentservice.displayname) objlogfile.writeline objlogfile.close Enumerating Dependent Services for a Single Service Enumerates all the services that cannot start until the Rasman service has started.

Enumerating Inactive Services Returns a list of all the services installed on a computer that are currently stopped. SQL="SELECT DisplayName, State FROM Win32 Service WHERE State <> 'Running'" Set objwmiservice= GetObject("winmgmts:" & "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2") Set colstoppedservices=objwmiservice.execquery(sql) For Each objservice in colstoppedservices & "=" & objservice.state Enumerating Service Load Order Groups Returns a list of all the service load order groups found on a computer, and well as their load order. On Error Resume SQL="Select * from Win32 LoadOrderGroup" Set objwmiservice=getobject("winmgmts:\\" & strcomputer & "\root\cimv2") Set colitems=objwmiservice.execquery(sql) For Each objitem in colitems Wscript.Echo "Driver Enabled: " & objitem.driverenabled Wscript.Echo "Group Order: " & objitem.grouporder Wscript.Echo "Name: " & objitem.name Wscript.Echo Installing a Service Installs a hypothetical service Db.exe. Const OWN PROCESS=16 Const NOT INTERACTIVE=False Const NORMAL ERROR CONTROL=2 Set objservice=objwmiservice.get("win32 BaseService") SvcName="DbService" SvcDesc="Personnel Database" SvcPath="c:\windows\system32\db.exe" SvcStart="Manual" SvcLogon="NT AUTHORITY\LocalService" errreturn=objservice.create(svcname, SvcDesc, SvcPath, OWN PROCESS, NORMAL ERROR CONTROL, _ SvcStart, NOT INTERACTIVE, SvcLogon, "") Wscript.Echo errreturn Monitoring Service Performance Uses formatted performance counters to retrieve performance data for the DHCP Server service. set objrefresher=createobject("wbemscripting.swbemrefresher") Set coldhcpserver=objrefresher.addenum(objwmiservice, _ "win32 PerfFormattedData DHCPServer DHCPServer").ObjectSet objrefresher.refresh For i=1 to 60 For Each objdhcpserver in coldhcpserver Wscript.Echo "Acknowledgements per second: " & objdhcpserver.ackspersec Wscript.Echo "Declines per second: " & objdhcpserver.declinespersec Wscript.Echo "Discovers per second: " & objdhcpserver.discoverspersec Wscript.Echo "Informs per second: " & objdhcpserver.informspersec Wscript.Echo "Offers per second: " & objdhcpserver.offerspersec Wscript.Echo "Releases per second: " & objdhcpserver.releasespersec Wscript.Echo "Requests per second: " & objdhcpserver.requestspersec Wscript.Sleep 10000 objrefresher.refresh Pausing Services Running Under a Specific Account Pauses all services running under the hypothetical service account Netsvc. If objservice.startname=".\netsvc" Then errreturncode=objservice.pauseservice() Removing a Service Removes a hypothetical service named DbService. SQL="Select * from Win32 Service Where Name='DbService'"

objservice.stopservice() objservice.delete() Resuming AutoStart Services that are Paused Restarts any auto-start services that have been paused. SQL="Select * from Win32 Service Where State='Paused' and StartMode='Auto'" objservice.resumeservice() Retrieving Service Properties Retrieves a complete list of services and their associated properties. Information is saved to a text file: C:\Scripts\Service List.cs. Const ForAppending=8 Set objfso=createobject("scripting.filesystemobject") Set objlogfile=objfso.opentextfile("c:\scripts\service list.csv", ForAppending, True) Hdg="System Name, Service Name, Service Type, Service State, Exit Code, Process ID, Can Be Paused, " Hdg=Hdg & "Can Be Stopped, Caption, Description, Can Interact with Desktop, Display Name, " Hdg=Hdg & "Error Control, Executable Path Name, Service Started, Start Mode, Account Name" objlogfile.write(hdg) objlogfile.write(objservice.systemname) & ", " objlogfile.write(objservice.name) & ", " objlogfile.write(objservice.servicetype) & ", " objlogfile.write(objservice.state) & ", " objlogfile.write(objservice.exitcode) & ", " objlogfile.write(objservice.processid) & ", " objlogfile.write(objservice.acceptpause) & ", " objlogfile.write(objservice.acceptstop) & ", " objlogfile.write(objservice.caption) & ", " objlogfile.write(objservice.description) & ", " objlogfile.write(objservice.desktopinteract) & ", " objlogfile.write(objservice.displayname) & ", " objlogfile.write(objservice.errorcontrol) & ", " objlogfile.write(objservice.pathname) & ", " objlogfile.write(objservice.started) & ", " objlogfile.write(objservice.startmode) & ", " objlogfile.write(objservice.startname) & ", " objlogfile.writeline objlogfile.close Retrieving Service Status Returns a list of all the services installed on a computer, and indicates their current status (typically, running or not running). Set colrunningservices=objwmiservice.execquery(sql) For Each objservice in colrunningservices & VbTab & objservice.state Retrieving Service Status Changes from Event Logs Retrieves events from the System event log that have an event ID of 7036. These events are recorded any time a service changes status. Set dtmconverteddate=createobject("wbemscripting.swbemdatetime") SQL="Select * from Win32 NTLogEvent Where Logfile='System' and EventCode='7036'" Set colserviceevents=objwmiservice.execquery(sql) For Each strevent in colserviceevents dtmconverteddate.value=strevent.timewritten Wscript.Echo dtmconverteddate.getvardate Wscript.Echo strevent.message Starting AutoStart Services that have Stopped Restarts any auto-start services that have been stopped. SQL="Select * from Win32 Service Where State='Stopped' and StartMode='Auto'" objservice.startservice()

Starting a Service and Its Dependents Starts the NetDDE service and all its dependent services. SQL="Select * from Win32 Service where Name='NetDDE'" errreturn=objservice.startservice() Wscript.Sleep 20000 SQL="Associators of {Win32 Service.Name='NetDDE'} Where AssocClass=Win32 DependentService Role=Dependent" objservice.startservice() Stopping a Service and Its Dependents Stops the NetDDE service and all its dependent services. SQL="Associators of {Win32 Service.Name='NetDDE'} Where AssocClass=Win32 DependentService Role=Antecedent" objservice.stopservice() Wscript.Sleep 20000 SQL="Select * from Win32 Service where Name='NetDDE'" errreturn=objservice.stopservice() Stopping Services Running Under a Specific Account Stops all services running under the hypothetical service account Netsvc. SQL="Select * from win32 Service" If objservice.startname=".\netsvc" Then errreturncode=objservice.stopservice() Switching Service Accounts to Local Service Changes the service account to LocalService for any services running under the hypothetical service account Netsvc. If objservice.startname=".\netsvc" Then errservicechange=objservice.change(,,,,,, "NT AUTHORITY\LocalService", "") Copyright 2014 by GO Software Pty Limited