PRTG Custom Sensor: Alarm for Large File

Requirement

Need to check for any file larger then let’s say 60 Mb and save its name somewhere, and raise alarm on PRTG.

Tools/Environment

Powershell, PRTG, Windows Server 2012 R2.

Powershell Script

Following script will look for any file larger then 60 Mb, of file type wav, in F:\Dir\SubDir\SubDirL2\SubDirL3\ and will save it to F:\Dir\res.txt and keep it on appending it with the results.

##Mention the path to search the files
$path = “F:\Dir\SubDir\SubDirL2\SubDirL3\”
##Find out the files greater than equal to below mentioned size
$size = 60MB
##Limit the number of rows in text file mentioning file names
$limit = 5
##Find out the specific extension file
$Extension = “*.wav”
##script to find out the files based on the above input
$largeSizefiles = get-ChildItem -path $path -recurse -ErrorAction “SilentlyContinue” -include $Extension | ? { $_.GetType().Name -eq “FileInfo” } | where-Object {$_.Length -gt $size} | sort-Object -property length -Descending | Select-Object Name, @{Name=”SizeInMB”;Expression={$_.Length / 1MB}},@{Name=”Path”;Expression={$_.directory}} -first $limit
IF ($largeSizefiles -eq $NULL)

{
$res = “NORMAL”
$date = Get-Date
Out-File -FilePath F:\Dir\res.txt -InputObject $date -Encoding Default
Out-File -FilePath F:\Dir\res.txt -InputObject $res -Encoding Default -Append
}
ELSE
{
$res = “ERROR”
$date = Get-Date -UFormat “%Y%m%d%H%M%S”
Out-File -FilePath F:\Dir\res.txt -InputObject $date -Encoding Default
Out-File -FilePath F:\Dir\res.txt -InputObject $res -Encoding Default -Append
$largeSizefiles | Out-File -FilePath F:\Dir\res.txt -Encoding Default -Append
}

Run Script Periodically

Using Windows Task Scheduler, the script can be run periodically every 5 minutes. Create new task with following settings:

2016-01-28 16_41_52-10.150.10.160 - Remote Desktop Connection

2016-01-28 16_43_49-10.150.10.160 - Remote Desktop Connection

2016-01-28 16_44_25-10.150.10.160 - Remote Desktop Connection.png

 

PRTG Sensor Settings

  • Go to corresponding probe and the machine where you set up the previous Powershell Script.
  • Go to device list of that machine and add new sensor “File Sensor” with following settings:

2016-01-28 16_52_59-60MB+ Recorded File _ Sensor Details _ PRTG

2016-01-28 16_55_12-60MB+ Recorded File _ Sensor Details _ PRTG2016-01-28 16_56_33-60MB+ Recorded File _ Sensor Details _ PRTG.png

Change Scanning interval to your desired time.

Results:

2016-01-28 16_58_39-60MB+ Recorded File _ Sensor Details _ PRTG

The error will be displayed whenever there’s wav file larger then 60 Mb in the location mentioned earlier. You can also look for any word other then “Error” and raise the alarm.

Advertisements

Powershell Script to Check Domain Machines Disk Sizes

We have around 15 servers in the data center all part of single domain. Our support folks used to take their Disk Volume Sized twice a day to send it to Analysis team. They were using Remote Desktop to manually login to take the sizes until I wrote this script to make their lives easier.

Please note that this is an unoptimized, first draft of the script. I will try to further improve and optimize it later on and will include Excel Integration with it.

<#
Script Name:                      SysCheckAuth
Author:                                Maaz Bin Mahmood
Tested Platforms:               Windows 8.1, Windows Server 2012
Dated:                                 26th October 2014
Contact Email:                    pointed.out@gmail.com
#>

<#First step is to declare the authentication. We will be needing Username in Domain\User format and Password that will be prompted in the beginning. We are assuming that all Servers have same password as happened in my case. The IP or Server Name is different for every machine. In case passwords are different too, you will have to prompt for password for every machine.
#>

$UserName = “DOMAIN\user”
$Password = Read-Host -AsSecureString “Enter Your Password:”
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName , $Password

Write-Output “`r`n`r`nGenerating Health Check of Web Server 1… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.1.26 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “C Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.1.26 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.1.26 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.1.26 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Web Server 2… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.169.1.26 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.169.1.26 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.169.1.26 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.169.1.26 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of ACD Server 1… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.1.28 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.1.28 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.1.28 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.1.28 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of ACD Server 2… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.169.1.28 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.169.1.28 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.169.1.28 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.169.1.28 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of SQL Server 1… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalF = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’F:'” | Foreach-Object {$_.size}
$gbTotalF = [int64]$TotalF / 1GB
Write-Output “`r`nF Drive (DB File) Total Capacity: “$gbTotalF | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeF = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’F:'” | Foreach-Object {$_.freespace}
$gbFreeF = [int64]$FreeF / 1GB
Write-Output “`r`nF Drive (DB File) Available Capacity: “$gbFreeF | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalL = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’L:'” | Foreach-Object {$_.size}
$gbTotalL = [int64]$TotalL / 1GB
Write-Output “`r`nL Drive (Log File) Total Capacity: “$gbTotalL | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeL = get-WmiObject win32_logicaldisk -Computername 192.168.1.27 -Credential $Credential -Filter “DeviceID=’L:'” | Foreach-Object {$_.freespace}
$gbFreeL = [int64]$FreeL / 1GB
Write-Output “`r`nL Drive (Log File) Available Capacity: “$gbFreeL | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of SQL Server 2… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalF = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’F:'” | Foreach-Object {$_.size}
$gbTotalF = [int64]$TotalF / 1GB
Write-Output “`r`nF Drive (DB File) Total Capacity: “$gbTotalF | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeF = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’F:'” | Foreach-Object {$_.freespace}
$gbFreeF = [int64]$FreeF / 1GB
Write-Output “`r`nF Drive (DB File) Available Capacity: “$gbFreeF | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalL = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’L:'” | Foreach-Object {$_.size}
$gbTotalL = [int64]$TotalL / 1GB
Write-Output “`r`nL Drive (Log File) Total Capacity: “$gbTotalL | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeL = get-WmiObject win32_logicaldisk -Computername 192.169.1.27 -Credential $Credential -Filter “DeviceID=’L:'” | Foreach-Object {$_.freespace}
$gbFreeL = [int64]$FreeL / 1GB
Write-Output “`r`nL Drive (Log File) Available Capacity: “$gbFreeL | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Slave 1-1… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “C Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Slave 1-2… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.3.41 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.3.41 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.3.41 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.3.41 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Slave 1-3… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.3.40 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Slave 1-4… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.169.3.41 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.169.3.41 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.169.3.41 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.169.3.41 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of FLASH Server… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.1.35 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.1.35 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.1.35 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.1.35 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Recording Server… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.1.40 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.1.40 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.1.40 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.1.40 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalF = get-WmiObject win32_logicaldisk -Computername 192.168.1.40 -Credential $Credential -Filter “DeviceID=’F:'” | Foreach-Object {$_.size}
$gbTotalF = [int64]$TotalF / 1GB
Write-Output “`r`nF Drive (DB File) Total Capacity: “$gbTotalF | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeF = get-WmiObject win32_logicaldisk -Computername 192.168.1.40 -Credential $Credential -Filter “DeviceID=’F:'” | Foreach-Object {$_.freespace}
$gbFreeF = [int64]$FreeF / 1GB
Write-Output “`r`nF Drive (DB File) Available Capacity: “$gbFreeF | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Telepoti Server 1… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.168.1.32 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.168.1.32 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.168.1.32 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.168.1.32 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

Write-Output “`r`n`r`nGenerating Health Check of Telepoti Server 2… Please wait`r`n_____________________________________________________________`n`r`n” | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append
$TotalC = get-WmiObject win32_logicaldisk -Computername 192.169.1.32 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.size}
$gbTotalC = [int64]$TotalC / 1GB
Write-Output “`r`nC Drive Total Capacity: “$gbTotalC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeC = get-WmiObject win32_logicaldisk -Computername 192.169.1.32 -Credential $Credential -Filter “DeviceID=’C:'” | Foreach-Object {$_.freespace}
$gbFreeC = [int64]$FreeC / 1GB
Write-Output “`r`nC Drive Available Capacity: “$gbFreeC | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$TotalD = get-WmiObject win32_logicaldisk -Computername 192.169.1.32 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.size}
$gbTotalD = [int64]$TotalD / 1GB
Write-Output “`r`nD Drive Total Capacity: “$gbTotalD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append

$FreeD = get-WmiObject win32_logicaldisk -Computername 192.169.1.32 -Credential $Credential -Filter “DeviceID=’D:'” | Foreach-Object {$_.freespace}
$gbFreeD = [int64]$FreeD / 1GB
Write-Output “`r`nD Drive Available Capacity: “$gbFreeD | Tee-Object -FilePath  $PSScriptRoot\output.txt -Append