Skip to main content

Restart a Windows Service (Parameterized Tanium Package)

OVERVIEW
This package restarts a Windows service by stopping it and then restarting it. It uses a single required parameter (the service name) so the same package can be reused for different services across endpoints.

PRIMARY COMMAND (Parameterized)

cmd.exe /d /c net stop "$1" && net start "$1"

WHAT THIS COMMAND DOES
• cmd.exe /c runs the command and exits when done
• /d disables AutoRun commands from the registry for consistent execution
• net stop "$1" stops the service specified by the first package parameter
• && ensures the start only runs if the stop succeeds
• net start "$1" starts the same service

REQUIRED PARAMETER
Parameter #1 ($1)
Name (suggested): ServiceName
Type: String
Required: Yes
Description: Windows service “SERVICE_NAME” value (not the display name)

IMPORTANT NOTE ABOUT SERVICE NAME VS DISPLAY NAME
The parameter must be the service name (SERVICE_NAME), not the friendly Display Name.
Examples:
• Correct service name: Spooler
• Correct service name: wuauserv
• Incorrect display name: Print Spooler

HOW TO FIND THE SERVICE NAME IN TANIUM (RECOMMENDED METHOD)
Use Tanium Interact to collect service inventory from endpoints and then filter for the service you need.

Step-by-step:

  1. Go to Interact.

  2. Ask the question: Get Service Details from all machines

  3. Filter the results for the expected service by searching for either:
    • Service Name (SERVICE_NAME), or
    • Display Name (friendly name)

  4. Confirm the exact Service Name value you will use as the package parameter.

Tip: Always copy the Service Name exactly as shown in the results to avoid mismatch issues.