Yo Gabba Gabba Cool Tricks 2: Capture all windows services on a text file before performing a major change on your Windows System

~ Begin your task ~

Step 1: Copy the following into notepad and give a name with file extension .vbs

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:” _

& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”)

Set colRunningServices = objWMIService.ExecQuery _

(“Select * from Win32_Service”)

For Each objService in colRunningServices

Wscript.Echo objService.DisplayName & VbTab & objService.State

Next

Step 2: I have given it a name of “listservices.vbs”. Also, to make my life easier, I have placed the file under C:\.

Step 3: Now open the command line with Administrator privileges

Step 4: First, move down to the location where you have saved your file, then run the visual basic script as below. I am saving the file in the same location with the name and date reference.

C:\>cscript listservices.vbs > c:\listservices17092015.txt

If you want to save this file in a specific location, you can create a folder and save it like this:

C:\>cscript listservices.vbs > c:\service list history\listservices17092015.txt

After you have run the script, a file will be saved with the file name given as below:

Now keep this copy of file for later use. When you open the file with Notepad++, it looks similar to below:

Step 5: Now perform your changes to the system, and compare the difference. In this example, I have manually stopped some services to demonstrate this in our example. I have given the file name “listservices17092015_after.txt”.

Step 6: Now open both files in Notepad++ and use ‘compare’ tool to pin point the stopped services. If this was a Windows Enterprise Server such as DHCP, AD, etc., one interrupted service will cause a big outage, now you know how to pin point the stopped or hanging service, you can restart it from windows services console. To easily get to Windows services console, go to Run >type in ‘services.msc’.

~ Task ended ~

Reference:

https://technet.microsoft.com/en-au/library/ee156587.aspx

https://notepad-plus-plus.org/

Advertisements