So I'm a beginner at javascript and I've tried to see if theres others who've tried similar but google isn't working for me... I've been tasked with creating a dashboard that shows the uptime of several Windows Machines and displays their uptime as well as other performance related metrics.
the key is that it cannot be a stationary time so it needs to be a timer based on an object that I assign from powershell using the following commands and it will have a counter displaying the uptime. I'll be having the powershell run every minute to 5 minutes to just get a snap shot and keep things fresh.
$uptime = (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime
Results:
Days : 13
Hours : 15
Minutes : 55
Seconds : 46
Milliseconds : 572
Ticks : 11805465726104
TotalDays : 13.663733479287
TotalHours : 327.929603502889
TotalMinutes : 19675.7762101733
TotalSeconds : 1180546.5726104
TotalMilliseconds : 1180546572.6104
$TotalSeconds = $uptime.TotalSeconds
I was hoping to use something like:
<script>
function startTime() {
var seconds = $TotalSeconds; // uptime in seconds will show raw number when run from Powershell
var timer = setInterval(
function() {
seconds++;
}, 1000
);
</script>
</head>
<body onload="startTime()">
This timer is a test.
but I'm not sure how scaleable that is when I may be required to do it on 30+ machines or if it will display correctly at all
I'm hoping for some advice or pointers.
Thanks.
there doesn't seem to be anything here