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

Advertisements