Get-TempHumidData.ps1


Description

Get-TempHumidData monitors the most recent temperature and humidity sample stored in \\HOTH\TEMPerX\TEMPerX\1.csv. The function temporarily resizes the console window, reads the last CSV row, displays it, waits five seconds, clears the screen, and loops to provide a live feed. A helper Restore-Console function is included so you can return the console to its original size when finished.

Usage examples

Get-TempHumidData
# When finished
Restore-Console

Ensure Set-ConsoleConfig is available in your session and that the network share is accessible before running the monitor.


Script

Function Get-TempHumidData {
    Set-ConsoleConfig -WindowHeight 2 -WindowWidth 45
    Get-Content -Path "\\HOTH\TEMPerX\TEMPerX\1.csv" | ConvertFrom-Csv -Delimiter ',' | Select-Object -Last 1
    Start-Sleep -Seconds 5
    Clear-Host
    Get-TempHumidData
}

Function Restore-Console {
    Set-ConsoleConfig -WindowHeight 40 -WindowWidth 150
}

Back to Top


Download

Please feel free to copy parts of the script or if you would like to download the entire script, simple click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.


Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.

Issue


Back to Top