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

PPTP Client Setup on CentOS

It can be simple or complicated. For complicated there’s Google. But if for some reason you’ve reach here on this page, here’s the simple way to configure yout PPTP VPN on CentOS.

First, search for yum package for your OS using:

yum search pptp

You may find different results. Go for one with something like pptp.i686 or pptp.x86_64 (you’re not going to see both of them rather just one depending upon your machine processor architecture, i.e. 32 bit or 64 bit). Assuming that yours is x86, you will have to go with:

yum -y install pptp.i686

Once done, install pptp-setup to simplify the whole PPTP Client Setup:

yum -y install pptp-setup

That’s it. Installation part is done. Now to start VPN Client:
pptpsetup –create your_vpn_connection_name –server vpn_server_hostname_or_ip –username your_vpn_server_username –password your_vpn_server_password –encrypt –start

After this, don’t forget to route your traffic to VPN. You have to delete the current default route first:

route del default

and then add the new one pointing to your PPTP device:

 

route add default dev ppp0

That’s it. You’re encrypted and anonymous on your ISP now (except deep packet filtering ones).

To stop the pptp service:

pptpsetup –delete yout_vpn_connection_name

Don’t forget to add back the default gateway (assuming that your eth0 IP is 10.0.8.166), followed by Network Service restart:

route add default gateway 10.0.8.166 eth0

service network restart