Add PC uptime tracking feature

- Database: Add lastboottime column to machines table
- API: Accept lastBootUpTime parameter and store in lastboottime column
- PowerShell: Collect LastBootUpTime from Win32_OperatingSystem
  - Update-PC-Minimal.ps1: Add last boot time collection
  - Update-ShopfloorPCs-Remote.ps1: Add last boot time collection and API posting
- Display: Add Uptime column to displaypcs.asp with color-coded badges
  - > 90 days: red badge
  - > 30 days: yellow badge
  - > 7 days: blue badge
  - <= 7 days: muted text
- Filter: Add "Uptime > X days" filter dropdown (7, 30, 90 days)
- SQL: Production migration script for lastboottime column

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-09 09:36:23 -05:00
parent 01d4aae38d
commit cd9058d81e
5 changed files with 125 additions and 11 deletions

View File

@@ -327,6 +327,7 @@ function Get-RemotePCInfo {
$result.Model = $computerSystem.Model
$result.LoggedInUser = $computerSystem.UserName
$result.OSVersion = $os.Caption
$result.LastBootUpTime = if ($os.LastBootUpTime) { $os.LastBootUpTime.ToString("yyyy-MM-dd HH:mm:ss") } else { $null }
# Get network interfaces
$networkAdapters = Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration |
@@ -692,6 +693,11 @@ function Send-PCDataToApi {
osVersion = $PCData.OSVersion
}
# Add last boot time if available
if ($PCData.LastBootUpTime) {
$postData.lastBootUpTime = $PCData.LastBootUpTime
}
# Add machine number if available
if ($PCData.MachineNo) {
$postData.machineNo = $PCData.MachineNo