Posts

Understanding PowerShell’s Execution_Policy and Scope functionality - Part 1

Image
Windows started life as a text-based OS that had graphical elements bundled on top. Today most of the interaction with the OS is done through the graphical interface although the underlying text-based interface still exists and is important to reach certain nooks and crannies that are not exposed graphically. The command prompt or cmd was the first and (still) default character-based scripting language to interact with the components making up the operating system.  In 2006 an alternative called PowerShell (PS) became available for Windows. PS is an environment that manipulates configuration files and runs scripts. PS constructs make it easier to develop more complex solutions than with cmd. The latest version of PS is 7.  Version 7 is available for other platforms other than Windows. Joining cmd commands into a script was done in a text file with the extension bat or (later) cmd extensions while PS scripts are identified using the ps1 extension.     PowerShell under Windows has a sa

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