Service cannot be started. System.ComponentModel.Win32Exception
(0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo)
at icinga_service.src.classes.Agent.StartAgent()
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object
state)
## Reason
The `icingapowershell` service of the `Icinga for Windows` solution is unable to locate `powershell.exe`. The service is using `powershell.exe` natively without any directory configuration and looking up the `PATH` variable which normally includes a path like `C:\Windows\System32\WindowsPowerShell\v1.0` which contains the required `powershell.exe`
To resolve this issue, ensure that your `PATH` environment variable is containing a directory which inherits a `powershell.exe`. By default, this should be `C:\Windows\System32\WindowsPowerShell\v1.0`.
You can check this by opening a PowerShell by running the following command:
```powershell
($ENV:Path).Split(';')
```
If there is no directory listed containing a `powershell.exe`, you will have to add this path manually. You can either use the UI for this or modify and run the following PowerShell code within an Administrator shell to add a new path permanently to the `PATH` variable by modifying the registry:
```powershell
# The variable containing the folder we want to include
You can use the UI for modifying the `PATH` variable. Please follow the steps below
* Click on `Windows/Start` with the right mouse button
* Click on `System`
* In the new windows click in `Advanced System Settings` (on Windows 2012 R2 or older on the left side, on Windows 2016 or newer on the right side)
* Click on the `Advanced` tab
* Click on `Environment Variables`
* In the section `System variables` locate the entry `Path` and double click or simply left click to select it and then click the `Edit` button
Windows 2012 R2 or older:
* Jump to the end of the textbox `Value of Variable` (containing different directories) and add a `;` if not already present. Afterwards add the path containing your `powershell.exe`, like `C:\Windows\System32\WindowsPowerShell\v1.0`
* Close all windows by clicking on `OK`
Windows 2016 or newer
* Click the `New` button on the top-right of the new window
* Add the path containing your `powershell.exe`, like `C:\Windows\System32\WindowsPowerShell\v1.0` on the newly created entry
* Close all windows by clicking on `OK`
Now open a new PowerShell session again and check of the new directory was added:
```powershell
($ENV:Path).Split(';')
```
Once the directory is there, restart the `icingapowershell` service by running