Ticket #731: smartd_warning.cmd

File smartd_warning.cmd, 649 bytes (added by Gabriele Pohl, 6 years ago)
Line 
1@echo on
2:: This is just a wrapper to launch a PowerShell email script
3:: Author: David Schaerer, ETH Zurich, 2016/07/14
4
5REM Find out the location of the running service smartd.exe and set this location to run the PowerShell script.
6FOR /F "tokens=* USEBACKQ" %%F IN (`%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe get-process smartd ^^^| fl path`) DO (
7SET smartdloc=%%F
8)
9set smartdloc=%smartdloc:smartd.exe=%
10set smartdloc=%smartdloc:Path : =%
11
12REM Launch a PowerShell script that will send the smartd warings by email.
13PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {set-location %smartdloc%;./emailSender.ps1}"