Download Scritp powershell from https://gallery.technet.microsoft.com/scriptcenter/Disk-Space-Report-Reports-98e64d65
- Edit :
# EMAIL PROPERTIES
# Set the recipients of the report.
$users = YourDistrolist@company.com
# REPORT PROPERTIES
# Path to the report
$reportPath = "D:\Jobs\DiskSpaceQuery\Reports\";
# Get computer list to check disk space
$computers = Get-Content "servers_c.txt";
# Send Notification if alert $i is greater then 0
if ($i -gt 0)
{
foreach ($user in $users)
{
Write-Host "Sending Email notification to $user"
$smtpServer = "MySMTPServer"
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$msg = New-Object Net.Mail.MailMessage
$msg.To.Add($user)
$msg.From = "myself@company.com"
$msg.Subject = "Environment DiskSpace Report for $titledate"
$msg.IsBodyHTML = $true
$msg.Body = get-content $diskReport
$smtp.Send($msg)
$body = ""
}
}
=============================================================================
Create Task Schedule Report
Program/script :
Powershell
Add arguments (optional) : -file "E:\SETUP\Script\Disk Report\CheckDiskSpace_post.ps1"
CMIIW, Thanks