Posts

Showing posts from 2021

20210418: 100Km Bike ride

50 km North of Malta

HOWTO Manage PowerShell ExecutionPolicy mechanism

Image
   PowerShell has a mechanism called ExecutionPolicy that restricts running of  unsigned scripts.  This is intended to protect users from running malicious scripts. There are situations in which such scripts need to be run.  This HOWTO explains the various options that are available focusing on staying secure. More information on the ExecutionPolicy is available at: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1      

HOWTO Install, Configure and Use Watch-Win32_UPS (UPSMonitor)

Image
This HOWTO explains the Watch-Win32_UPS PowerShell Uninterrupted Power Supply (UPS) utility. Watch-Win32_UPS allows you to monitor and take and shut down your computer if there is a power failure. It explains how to set it up, delves into the code and invites you to join the development effort behind this tool. GitHub URL for Watch-Win32_UPS: https://github.com/chribonn/UPSMonitor ​

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