--- title: Run Telegraf as a Windows service description: How to configure Telegraf as a Windows service using PowerShell. menu: telegraf_1_21: name: Run as Windows service weight: 20 parent: Administration --- Telegraf natively supports running as a Windows service. ## Download and run Telegraf as a Windows service {{% note %}} Installing a Windows service requires administrative permissions. To run PowerShell as an administrator, see "[Launch PowerShell as administrator](https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-windows-powershell?view=powershell-7#with-administrative-privileges-run-as-administrator)". {{% /note %}} In PowerShell _as an administrator_, do the following: 1. Use the following commands to download the Telegraf Windows binary and extract its contents to `C:\Program Files\InfluxData\telegraf\`: ```powershell > wget https://dl.influxdata.com/telegraf/releases/telegraf-{{% latest-patch %}}_windows_amd64.zip -UseBasicParsing -OutFile telegraf-{{< latest-patch >}}_windows_amd64.zip > Expand-Archive .\telegraf-{{% latest-patch %}}_windows_amd64.zip -DestinationPath 'C:\Program Files\InfluxData\telegraf\' ``` 2. Move the `telegraf.exe` and `telegraf.conf` files from `C:\Program Files\InfluxData\telegraf\telegraf-{{% latest-patch %}}` up a level to `C:\Program Files\InfluxData\telegraf`: ```powershell > cd "C:\Program Files\InfluxData\telegraf" > mv .\telegraf-{{% latest-patch %}}\telegraf.* . ``` Or create a [Windows symbolic link (Symlink)](https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/) to point to this directory. {{% note %}} The instructions below assume that either the `telegraf.exe` and `telegraf.conf` files are stored in `C:\Program Files\InfluxData\telegraf`, or you've created a Symlink to point to this directory. {{% /note %}} 3. Install Telegraf as a service: ```powershell > .\telegraf.exe --service install --config "C:\Program Files\InfluxData\telegraf\telegraf.conf" ``` Make sure to provide the absolute path of the `telegraf.conf` configuration file, otherwise the Windows service may fail to start. 3. To test that the installation works, run: ```powershell > C:\"Program Files"\InfluxData\telegraf\telegraf.exe --config C:\"Program Files"\InfluxData\telegraf\telegraf.conf --test ``` 4. To start collecting data, run: ```powershell telegraf.exe --service start ``` ## Logging and troubleshooting When Telegraf runs as a Windows service, Telegraf logs messages to Windows event logs. If the Telegraf service fails to start, view error logs by selecting **Event Viewer**→**Windows Logs**→**Application**. ## Windows service commands The following commands are available: | Command | Effect | |------------------------------------|-------------------------------| | `telegraf.exe --service install` | Install telegraf as a service | | `telegraf.exe --service uninstall` | Remove the telegraf service | | `telegraf.exe --service start` | Start the telegraf service | | `telegraf.exe --service stop` | Stop the telegraf service |