Disk Space HTML Email Alert and Email Report

Two scripts generates disk space email report and email alert for specified computers for their disks and volumes including mounted ones. This scripts excludes read-only 'System Reserved' partition on newer Operating Systems. Report script generates email report for all disks w

 
 
 
 
 
5 Star
(1)
1,612 times
Add to favorites
Storage
1/19/2013
E-mail Twitter del.icio.us Digg Facebook
  • here is the output for below script..please any one help me out of this issue.
    1 Posts | Last post July 06, 2018
    • Server	Drive Label	Drive	Total Capacity(GB)	Used Capacity(GB)	Free Space(GB)	Freespace %
      		C:\	59.66	20.32	39.34	65.94
      		C:\	59.66	20.32	39.34	65.94
      		C:\	59.66	20.32	39.34	65.94
      
  • any one please check this script? i am getting the same out put for each machine.
    1 Posts | Last post July 06, 2018
    • $ErrorActionPreference = "SilentlyContinue";
      $scriptpath = $MyInvocation.MyCommand.Definition 
      $dir = "C:\DiskSpaceReport" 
      
      #Variables to configure
      $percentWarning = 25;
      $percentCritcal = 15;
      $smtpServer = "#####" 
      $ReportSender = "####"  
      $users = "#####"; 
      $MailSubject = "DiskSpace Report for Devops"
      
      #No change needed from here!!!
      $reportPath = "$dir\Logs\"
      $reportName = "DiskSpaceRpt_$(get-date -format ddMMyyyy).html";
      $diskReport = $reportPath + $reportName
      $redColor = "#FF0000"
      $orangeColor = "#FBB917
      $whiteColor = "#FFFFFF"
      $greenColor = "#7FFF00"
      $i = 0;
      $computers = "machine1","machine2";
      $datetime = Get-Date -Format "MM-dd-yyyy_HHmmss";
      If (Test-Path $diskReport)
          {
              Remove-Item $diskReport
          }
      $titleDate = get-date -uformat "%m-%d-%Y - %A"
      $header = "
      		<html>
      		<head>
      		<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
      		<title>DiskSpace Report</title>
      		<STYLE TYPE='text/css'>
      		<!--
              	table {
                  		border: thin solid #666666;
              	}
      		td {
      			font-family: Tahoma;
      			font-size: 11px;
      			border-top: 1px solid #999999;
      			border-right: 1px solid #999999;
      			border-bottom: 1px solid #999999;
      			border-left: 1px solid #999999;
      			padding-top: 0px;
      			padding-right: 0px;
      			padding-bottom: 0px;
      			padding-left: 0px;
      		}
      		body {
      			margin-left: 5px;
      			margin-top: 5px;
      			margin-right: 0px;
      			margin-bottom: 10px;
      			table {
      			border: thin solid #000000;
      		}
      		-->
      		</style>
      		</head>
      		<body>
      		<table width='100%'>
      		<tr bgcolor='#CCCCCC'>
      		<td colspan='7' height='25' align='center'>
      		<font face='tahoma' color='#003399' size='4'><strong>DiskSpace Report for $titledate</strong></font>
      		</td>
      		</tr>
      		</table>
      "
       Add-Content $diskReport $header
       $tableHeader = "
       <table width='100%'><tbody>
      	<tr bgcolor=#CCCCCC>
          <td width='10%' align='center'>Server</td>
      	<td width='5%' align='center'>Drive Label</td>
      	<td wi
  • Get Rid of Volume names in Drive
    1 Posts | Last post June 28, 2017
    • Hi,
      
      iam getting extra drive such as \\volume with normal drives.how can i edit the query which doesnt show up \\volume.
      
      thanks
      Ranjith
  • Smtp port
    1 Posts | Last post December 28, 2016
    • HI!
      
       How can I change smtp port to 587?
      
      Thanks
  • Unable to setup Scheduled Task to launch DiskSpace Alert
    1 Posts | Last post March 20, 2014
    • Has anybody been able to successfully create a scheduled task to launch Disk Space Alert script?
  • How do I add folders?
    2 Posts | Last post July 16, 2013
    • Is there a way to add the child folders of a specific path? For instance: All directories 1 deep on d:\
      
      Thanks!
    • Kwjake, This script it specific to mounted SAN or local drives. This will not calculate directory size. You can use "Disk Usage - DU" and other PowerShell cmdlets such as get-childitem and measure-object to calculate folder size and script it to send an email notification.
  • Can I exclude a specific Drive Letter?
    2 Posts | Last post July 05, 2013
    • Can I exclude a specific Drive Letter?  I want to exclude our SWAP file drive "P".
    • Yes, you can edit variable $disks with ---- Get-WmiObject -ComputerName $computer -Class Win32_Volume -Filter "DriveType = 3" | Where-Object {$_.Label -ne "System Reserved" -and $_.DriveLetter -ne "P:"} ----