Automating server checks

Hi Guys,

We have a task we have to do everyday on all our clients servers we have to check the following things

Internet connection
Disk free space on all disks
Exchange Store Status
Exchange Mail Queues
Check the backup job status of either Widnows Backup/Backup Exec/Altatro Backup
Check if latest windows updates are install or if there are any updates pending
Make sure Trend AntiVirus is running.

I managed to get the disk space check and the internet connection test working
To test the internet connection i will just use

[blockquote]Test-Connection 8.8.8.8 | Export-Csv ‘C:\tmp\internettest.csv’[/blockquote]

and check the disk free space

[blockquote]#Create Array and set AlertState to 0

$AlertDisks = @()
$AlertState = 0

#WMI call and custom object creation

$Disks = Get-WmiObject -ComputerName localhost -Class win32_logicaldisk | Where-Object {$.MediaType -match “12”} |
select PSComputerName, DeviceID, VolumeName, @{Name=‘Size (GB)’ ;Expression={“{0:n2}” -f ($
.size/1gb)}}, @{Name=‘FreeSpace (GB)’ ;Expression={“{0:n2}” -f ($.FreeSpace/1gb)}}, @{Name=‘PercentFree’ ;Expression={“{0:n2}” -f ($.freespace/$_.size*100)}}

Write-Output $Disks [/blockquote]

If anyone has any ideas to check the other tasks or can help add all this in one script that would be awesome.

As I continue getting ways to check the other tasks I will add it to the topic

I found this online to test the internet connection

[blockquote]
#Start testing the connection and continue until the connection is good.
While (!(Test-Connection -computer 8.8.8.8 -count 1 -quiet)) {
Write-Host -ForegroundColor Red -NoNewline “Connection down…”
Start-Sleep -Seconds 2
}
#Connection is good
Write-Host -ForegroundColor Green “$(Get-Date): Connection up!”
[/blockquote]

You’re not asking for anything to earth shattering, I’m pretty sure you can find answers to everything with a couple of Internet searches. As far as reporting, you could generate an HTML email by using ConvertTo-HTML -Fragment and Send-MailMessage -BodyAsHTML

There are also some free e-books on this site for HTML Reporting that can get you a final report.

I’m not just trying to check just the exchange server but help on compiling all of the reporting in one.
Looks like I misunderstood the community aspect of the forum or it might be one user.

All I’m saying is you want a lot of information. The first step is getting the data you want whether it be in separate or a single script. Almost everything you want is available on the internet, including creating reports with Powershell. If you need help with a specific thing not working, I’m sure the community would be more than happy to assist you. Like how do I convert Test-Connection to a Boolean value (True\False):

function Get-ComputerInfo {
    $os = Get-CimInstance -ClassName Win32_OperatingSystem | Select Caption
    $computer = Get-CimInstance -ClassName Win32_ComputerSystem | Select Name, Manufacturer, @{Label="OperatingSystem"; Expression={$os.Caption}}

    $computer
}

function Test-InternetConnected {
    New-Object -TypeName PSObject -Property @{"InternetConnected" = $(Test-Connection -Computername 8.8.8.8 -Count 2 -Quiet);"DateTime"=(Get-Date);}
}


$htmlFrag1 = Get-ComputerInfo | ConvertTo-HTML -Fragment -As Table -PreContent "Computer Information:"
$htmlFrag2 = Test-InternetConnected | ConvertTo-HTML -Fragment -As Table  -PreContent "Internet Status:"

ConvertTo-HTML -Title "My Server Report" -Body "$htmlFrag1 $htmlFrag2" | Out-File C:\Temp\ServerReport.html
Invoke-Item C:\Temp\ServerReport.html

I need a report with 15 items and have 2 pieces isn’t asking the community for help, it’s asking them to do your research for you. I’m really not trying to be snooty or anything, but your asking for like a 500+ lines of code report and have 20 lines contributed.

Get the data you need (in a single or multiple script)
Modularize the code (create functions)
Convert it to a HTML report
Clean up report with CSS

I get what you’re saying, and that does make sense.
I was hoping someone has already done some kind of server check and would be able to help me.
But your update makes loads of sense, the community is not to create a whole script for you but to help you if your script is not working.