Powershell! Not tested yet, but it can give you an idea on how to
build your script based on your own needs:

#$ErrorActionPreference = "SilentlyContinue"
$StrServerName = $Args[0].ToString()

#Check the System Uptime
$wmiInfo = gwmi -class Win32_OperatingSystem -namespace root\cimv2
-computer $ServerName
$LastBootTime = $wmiInfo.ConvertToDateTime($wmiInfo.Lastbootuptime)
[TimeSpan]$SystemUptime = New-TimeSpan $LastBootTime $(get-date)
Write-host "The server" $ServerName.ToUpper() "has been up for"
$SystemUptime.days "day(s)," $SystemUptime.hours "hour(s),"
$SystemUptime.minutes "minute(s)," $SystemUptime.seconds "Second(s)"

$EventLogger = New-Object -type System.Diagnostics.Eventlog
-argumentlist System, $ServerName
$EventLogger.Source = "Windows PowerShell"
if ($SystemUptime.hours -lt 1) { $EventLogger.WriteEntry("The system
has been up for less than 1 hour.","Information") }
elseif ($SystemUptime.minutes -lt 5) { $EventLogger.WriteEntry("The
system has been up for less than 5 minutes.","Information") }
else { $EventLogger.WriteEntry("The system has been up more than 1
hour and 5 minutes.","Information") }


Hope that helps! Regards,

Rubens

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to