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 |
|
---|
5 | REM Find out the location of the running service smartd.exe and set this location to run the PowerShell script.
|
---|
6 | FOR /F "tokens=* USEBACKQ" %%F IN (`%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe get-process smartd ^^^| fl path`) DO (
|
---|
7 | SET smartdloc=%%F
|
---|
8 | )
|
---|
9 | set smartdloc=%smartdloc:smartd.exe=%
|
---|
10 | set smartdloc=%smartdloc:Path : =%
|
---|
11 |
|
---|
12 | REM Launch a PowerShell script that will send the smartd warings by email.
|
---|
13 | PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {set-location %smartdloc%;./emailSender.ps1}"
|
---|