Posts

Showing posts from March, 2021

PowerShell Utility: Reset-Logs

Image
  What is Reset-Logs Reset-Logs is a small utility that takes a log file (that must not be locked) and, [Optionally] Moves it into an archived state under a different name [Optionally] Emails it to a particular address Recreates it with an [Optional] Header History of Reset-Logs Initially Reset-Logs was part of the UPS Monitoring utility ( https://github.com/chribonn/UPSMonitor ) but has now been extracted into its own repository because it can be used standalone in other solutions that would benefit from log file recycling. The most up-to-date version of this utility can be downloaded from   https://github.com/chribonn/UPSMonitor PowerShell 7 Reset-Logs was tested on PowerShell 7. This version of PowerShell does not come installed by default on Windows. Information on how to install this version is available on the Microsoft page   Installing PowerShell on Windows Configure PowerShell execution policy if you get a PSSecurityException error If you get an error when you execute the scri

Windows UPS Monitor and Shutdown utility: Watch-Win32_UPS

Image
Watch-Win32_UPS is a utility written in  PowerShell  (v 7.1) that taps into the Windows Win32_Battery class in order to provide the following functions: * Email alerts * Logging functions * Action script Watch-Win32_UPS monitors the battery state, the percentage capacity and the estimated run time remaining (in minutes). It raised email alerts, logs events or invokes the shutdown script based on these settings. All options are customisable and optional. Watch-Win32_UPS can be setup so that no email alerts are generated, or have logging switched off. The Action script is optional as well. At least one of the three options must be activated for the utility to run (let's save CPU cycles if nothing useful is coming out of this.) For more information type        get-help .\Watch-Win32_UPS.ps1  or        .\Watch-Win32_UPS.ps1 –help The most up-to-date version of this utility can be downloaded from https://github.com/chribonn/UPSMonitor . Action Script The purpose of the action script is