I would like to add a powershell script to my low disk space alerts. I want to get a list of the top 10 largest files on the nodes that are alerting on low disk space. I watched a few videos and saw that you can trigger a powershell script to then add to the notes of the ticket it creates.
I am having issues getting the correct commands
Powershell script:
$Get =gci -r| sort -descending -property length | select -first 10 name, length |out-file -FilePath c:\temp\SW_cmd_test.txt
Write-Host 'Message:' $get
exit(0)
Network Path to external program:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted -NoProfile -File "D:\software\scripts\sw_test-cmd.ps1
and I added this to the email message:
${N=Alerting;M=Notes}
I also welcome the simplest of powershell script examples that I can build on. Like recording the highest CPU process.