How to list all installed windows services in C# and VB.NET

To list installed services in C# and VB.NET you can use the following snippet.

Sample C#

public static void ListInstalledServices()
{
	var services = ServiceController.GetServices();
	foreach (var service in services)
	{
		Console.WriteLine(@"Installed: {0}", service.ServiceName);
	}
}

Sample VB.NET

Public Shared Sub ListInstalledServices()
	Dim services = ServiceController.GetServices()
	For Each service As var In services
		Console.WriteLine("Installed: {0}", service.ServiceName)
	Next
End Sub

How to list the installed software using vbscript

to list installed software in vbscript you can use the following snippet.
It will export a CSV file with the installed software.

Sample VBScript

Set objFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystemObject.CreateTextFile("C:\CodesnippetsFesslersoft_InstalledSoftware.csv", True)
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colInstalledSoftware = objWMI.ExecQuery("Select * from Win32_Product")

'Header
objFile.WriteLine "" & chr(34) & "Caption" & chr(34) & ";" & chr(34) & "Description" & chr(34) & ";" & chr(34) & "Identifying Number" & chr(34) & ";" & chr(34) & "Install Date" & chr(34) & ";" & chr(34) & "Install Location" & chr(34) & ";" & chr(34) & "Install State" & chr(34) & ";" & chr(34) & "Name" & chr(34) & ";" & chr(34) & "Package Cache" & chr(34) & ";" & chr(34) & "SKU Number" & chr(34) & ";" & chr(34) & "Vendor" & chr(34) & ";" & chr(34) & "Version" & chr(34) & ";" 
		
'content
For Each objInstalledSoftware in colInstalledSoftware
	on error resume next
	objFile.WriteLine  chr(34) & objInstalledSoftware.Caption & chr(34) & ";" & chr(34) & objInstalledSoftware.Description & chr(34) & ";" & chr(34) & objInstalledSoftware.IdentifyingNumber & chr(34) & ";" & chr(34) & objInstalledSoftware.InstallDate2 & chr(34) & ";" & chr(34) & objInstalledSoftware.InstallLocation & chr(34) & ";" & chr(34) & objInstalledSoftware.InstallState & chr(34) & ";" &  chr(34) & objInstalledSoftware.Name & chr(34) & ";" & chr(34) & objInstalledSoftware.PackageCache & chr(34) & ";" & chr(34) & objInstalledSoftware.SKUNumber & chr(34) & ";" & chr(34) & objInstalledSoftware.Vendor & chr(34) & ";" & chr(34) & objInstalledSoftware.Version & chr(34) & ";"
Next
objFile.Close

Call msgbox("done",0,"codesnippets.fesslersoft.de")