Extract all non microsoft services from server

sc query state= all | findstr /I "SERVICE_NAME" > services.txt && for /f "tokens=2 delims=:" %a in (services.txt) do @for /f "tokens=1 delims= " %b in ("%a") do @sc qc "%b" | findstr /I "START_TYPE DISPLAY_NAME" | findstr /I /V "Microsoft" >> non_microsoft_services.txt

or

# Simple list of NON-Microsoft services to a text file (tabs between columns)
# --- Settings ---
$outFile = Join-Path $env:USERPROFILE 'Desktop\non_microsoft_services.txt'
# --- Helpers ---
function Expand-NormalizePath {
    param([string]$Path)
    if ([string]::IsNullOrWhiteSpace($Path)) { return $null }
    $s = $Path.Trim()
    # If quoted: take the first quoted token  "C:\Path With Spaces\svc.exe" -arg
    if ($s.StartsWith('"')) {
        $close = $s.IndexOf('"', 1)
        if ($close -gt 1) {
            # take quoted part
            $s = $s.Substring(1, $close - 1)
        }
    } else {
        # Unquoted: split on first space to drop args: C:\Path\svc.exe -arg
        $parts = $s.Split(' ', 2)
        $s = $parts[0]
    }
    $expanded = [Environment]::ExpandEnvironmentVariables($s)
    try {
        $resolved = Resolve-Path -LiteralPath $expanded -ErrorAction Stop
        return $resolved.ProviderPath
    } catch {
        # Return expanded path (may not exist); we'll check existence later
        return $expanded
    }
}
function Get-ServiceDllPath {
    param([string]$ServiceName)
    try {
        $reg = "HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName\Parameters"
        $dll = (Get-ItemProperty -Path $reg -Name ServiceDll -ErrorAction Stop).ServiceDll
        return Expand-NormalizePath -Path $dll
    } catch {
        return $null
    }
}
function Get-ServiceBinaryPath {
    param([Microsoft.Management.Infrastructure.CimInstance]$Svc)
    $exePath = Expand-NormalizePath -Path $Svc.PathName
    if (-not $exePath) { return $null }
    # If it's svchost.exe, resolve the backing ServiceDll for this service
    if ([System.IO.Path]::GetFileName($exePath).ToLower() -eq 'svchost.exe') {
        $dll = Get-ServiceDllPath -ServiceName $Svc.Name
        if ($dll) { return $dll }
    }
    return $exePath
}
function Get-CompanyName {
    param([string]$FilePath)
    if (-not $FilePath) { return $null }
    if (-not (Test-Path -LiteralPath $FilePath)) { return $null }
    try {
        return ([System.Diagnostics.FileVersionInfo]::GetVersionInfo($FilePath)).CompanyName
    } catch {
        return $null
    }
}
# --- Collect & Filter ---
$rows = @()
$all = Get-CimInstance Win32_Service
foreach ($svc in $all) {
    $bin = Get-ServiceBinaryPath -Svc $svc
    $company = Get-CompanyName -FilePath $bin
    if ($company -eq 'Microsoft Corporation') {
        continue  # hide Microsoft services
    }
    if (-not $company) { $company = 'Unknown' }
    $rows += [pscustomobject]@{
        ServiceName  = $svc.DisplayName
        Manufacturer = $company
        Status       = $svc.State       # Running / Stopped
    }
}
# --- Write output (tab-delimited text) ---
"Service Name`tManufacturer`tStatus" | Out-File -FilePath $outFile -Encoding UTF8
$rows |
    Sort-Object ServiceName |
    ForEach-Object {
        "$(

Extract all non microsoft services from server

{xdata}
.ServiceName)`t$(

Extract all non microsoft services from server

{xdata}
.Manufacturer)`t$(

Extract all non microsoft services from server

{xdata}
.Status)"
    } | Out-File -FilePath $outFile -Encoding UTF8 -Append
Write-Host "Saved list to: $outFile"