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