Uptime
Hello,
I would like to send automatically a report about my servers uptime.
I download uptime.exe file and did a bat from the hubcas 1:
uptimeuptime Hubcas02uptime mailbox01uptime mailbox2pause
But it does do what I would like to get.
I cannot connect to the edge + I would need to at least extract the data (to avoid the manual copy/paste)
So if someone knows maybe a shell script that could do the job I would be more than happy to get it :-D
Thanks all in advance.
Graig
March 26th, 2010 10:30am
This is fairly easy to do using PowerShell, I would probably do something like this:
Get-ExchangeServer | %{
if(Test-Connection $_.name -Count 1 -Quiet) {
$OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $_.name
$uptime = (Get-Date) - $OS.ConvertToDateTime($OS.LastBootUpTime)
$report += "$($_.name) has been up for {0} days, {1} hours and {2} minutes." `
-f $uptime.Days, $uptime.Hours, $uptime.Minutes + "`r"
}
}
Send-MailMessage -To administrator@yourdomain.com -From powershell@yourdomain.com `
-Subject "Server Uptime" -Body $report -SmtpServer server.yourdomain.com
Then I would just schedule it to run on one of the internal Exchange servers, and on the Edge server.
Free Windows Admin Tool Kit Click here and download it now
March 26th, 2010 8:03pm
Hello,
When I type just the below shell command,
[PS] C:\>"C:\uptime.ps1" C:\\uptime.ps1 [PS] C:\>
And it does not generate the information. Should I change something in the below script??
:
Get-ExchangeServer | %{
if(Test-Connection $_.name -Count 1 -Quiet) {
$OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $_.name
$uptime = (Get-Date) - $OS.ConvertToDateTime($OS.LastBootUpTime)
$report += "$($_.name) has been up for {0} days, {1} hours and {2} minutes." `
-f $uptime.Days, $uptime.Hours, $uptime.Minutes + "`r"
}
}
March 30th, 2010 1:44pm