System/Server Health Status using PowerShell

System/Server Health Status using PowerShell


Support team or System Administrators who are willing to get the system health check status can use this script. This script has been written in Powershell and it can generate reports in HTML format.

This script can give you below information:

Hardware:

To Get Manufacturer, Model, No. Of Logical Processors, Installed Memory.

 Code:  Get-WmiObject -class Win32_ComputerSystem -ComputerName $Computername | Select-Object Name,Domain,Manufacturer, Model,NumberOfLogicalProcessors,@{ Name = "Installed Memory (GB)" ; Expression = { "{0:N0}" -f( $_.TotalPhysicalMemory / 1gb ) } }           


CPU Details:

To Get  CPU speed, Current CPU Usage in %,

 Code: Get-WmiObject win32_processor | Select-Object SystemName,@{ Expression = { $_.MaxClockSpeed/1000 } ; Name = "CPU Speed in GHz." } ,NumberOfCores,NumberOfLogicalProcessors,@{ Name = "Current CPU Ussage in % " ; Expression = { $_.LoadPercentage } }




Memory Usage:
To Get Total Memory, Free memory, Used Memory.

Code: Get-WmiObject win32_operatingsystem | Select-object @{ Name = "Total Memory(MB) " ; expression = { "{0:N0}" -f($_.TotalVisibleMemorySize / 1024)  } } , @{ Name = "Free Memory(MB) " ; Expression = { "{0:N0}" -f ($_.FreePhysicalMemory / 1024) } },@{ Name = "Used Memeory(MB)" ; Expression = {"{0:N0}" -f (($_.TotalVisibleMemorySize-$_.FreePhysicalMemory) / 1024) } }

Hard Disk Information:

To Get Device Mount Point, Size of Hard Drive, Free Space Left, Percentage of Free Space
Code: Get-WmiObject win32_operatingsystem | Select-object @{ Name = "Total Memory(MB) " ;expression = { "{0:N0}" -f($_.TotalVisibleMemorySize / 1024)  } } , @{ Name = "Free Memory(MB) " ; Expression = { "{0:N0}" -f ($_.FreePhysicalMemory / 1024) } },@{ Name = "Used Memeory(MB)" ; Expression = {"{0:N0}" -f (($_.TotalVisibleMemorySize-$_.FreePhysicalMemory) / 1024) } }


Last Bootup Time:

To Get Operating System Used, Last Reboot on

Code: Get-WmiObject win32_operatingsystem | Select-object @{ Name = "Total Memory(MB) " ;expression = { "{0:N0}" -f($_.TotalVisibleMemorySize / 1024)  } } , @{ Name = "Free Memory(MB) " ; Expression = { "{0:N0}" -f ($_.FreePhysicalMemory / 1024) } },@{ Name = "Used Memeory(MB)" ; Expression = {"{0:N0}" -f (($_.TotalVisibleMemorySize-$_.FreePhysicalMemory) / 1024) } }

Services Running:

To Get Total Memory, Free memory, Used Memory.
Code: Get-WmiObject -Class Win32_Service -ComputerName $Computername |
 Where-Object { ($_.StartMode -eq "Auto") -and ($_.State -eq "Running") -and ($_.Name -eq "MySQL") -or ($_.Name -eq "AppHostSvc") } |  Select-Object SystemName, DisplayName, Name, StartMode, State, Description |  ConvertTo-Html -Fragment -PreContent "<h2>Services  Running </h2>"  Out-String

Top 5 Application Events Log:

To Get Index, Time, Entry Type, Source, Instance Id.

Code: Get-EventLog "Application" -Newest 5 | Select-Object Index,Time,EntryType,Source, InstanceID, Message 

OUTPUT : 

Output Link:
 

https://drive.google.com/file/d/0B9AQ1D2DEgAkRExxWE1SSXREVUk/edit?usp=sharing

https://drive.google.com/file/d/0B9AQ1D2DEgAkRExxWE1SSXREVUk/edit?usp=sharing

Download the Script :

https://drive.google.com/file/d/0B9AQ1D2DEgAkNFpuZnIzYnU1N0k/edit?usp=sharing


https://drive.google.com/file/d/0B9AQ1D2DEgAkNFpuZnIzYnU1N0k/edit?usp=sharing






If you have any queries and any one want any help in scripting or in enhancing this script please.

Suggestions and Queries are always welcome.





Comments

Popular posts from this blog

Observium: Configuring Microsoft Windows 2008 Server SNMP Agent

AWS: Upgrade PV Drivers on Windows Instances

How to configure Incremental backups for MSSQL Database