@echo off setlocal EnableExtensions set "OUT=%~1" if "%OUT%"=="" set "OUT=monitoring-daily.txt" echo === Daily monitoring summary ===>> "%OUT%" for /f "delims=" %%D in ('powershell -NoProfile -Command "(Get-Date).ToString('yyyy-MM-dd HH:mm:ss')"') do echo Generated: %%D>> "%OUT%" for /f "delims=" %%U in ('powershell -NoProfile -Command "$os=Get-CimInstance Win32_OperatingSystem; [math]::Round(((Get-Date)-$os.LastBootUpTime).TotalHours,1)"') do echo Uptime hours: %%U>> "%OUT%" for /f "delims=" %%M in ('powershell -NoProfile -Command "$os=Get-CimInstance Win32_OperatingSystem; [math]::Round(($os.TotalVisibleMemorySize-$os.FreePhysicalMemory)/$os.TotalVisibleMemorySize*100,1)"') do echo Memory used percent: %%M>> "%OUT%" for /f "delims=" %%S in ('powershell -NoProfile -Command "Get-PSDrive -PSProvider FileSystem | ForEach-Object { if (($_.Used + $_.Free) -gt 0) { '{0} {1}%%' -f $_.Name, [math]::Round($_.Used/($_.Used+$_.Free)*100,1) } }"') do echo Disk %%S>> "%OUT%" echo.>> "%OUT%" echo Report appended: %OUT% exit /b 0