Tanium Sensor: Parameterized Service State & Start Mode

This page documents the Parameterized Tanium Sensor: Service State & Start Mode, which allows operators to query the status and startup mode of any Windows service by providing a service name as an input parameter.


Overview

This parameterized sensor enables Tanium users to:


Parameters

The parameter token ||ServiceName|| allows Tanium to inject user-supplied values when the sensor is executed.


Example Tanium Usage

In Interact, users would enter:


Get Parameterized Service State[ ServiceName="wuauserv" ]

Example output:


Running | Auto

Script Code

# Parameterized Tanium Sensor: Service State & Start Mode

# Declare parameters so Tanium knows they are used
$parameters = @("||ServiceName||")

# Tanium will substitute the user's input into this token
$svcName = "||ServiceName||"

if ([string]::IsNullOrWhiteSpace($svcName)) {
    Write-Host "No service specified"
    exit
}

try {
    # Use Win32_Service for richer metadata
    $svc = Get-WmiObject -Class Win32_Service -Filter "Name='$svcName'" -ErrorAction Stop
}
catch {
    Write-Host "Service not found"
    exit
}

if (-not $svc) {
    Write-Host "Service not found"
    exit
}

# Output both State and StartMode (space-delimited or pipe-delimited)
Write-Host "$($svc.State) | $($svc.StartMode)"

Output Format

The sensor returns:


<CurrentState> | <StartMode>

Examples:


Common Use Cases


Notes

 


Revision #1
Created 28 November 2025 23:44:19 by Christian Kaba
Updated 28 November 2025 23:47:18 by Christian Kaba