Category: PowerShell

PowerShell & Windows Admin Blog Archives, by Peter Whyte, an experienced SQL Server Database Administrator.

  • How to Check Windows Firewall Status with PowerShell

    Want to quickly check whether your Windows Firewall is enabled or disabled? This guide shows you how to use PowerShell to get the status of your local Windows Firewall for each profile. PowerShell cmdlets follow a standard format: verb-noun. The verb describes the action, and the noun specifies…

    Read More


  • How to Enable Windows Firewall using PowerShell

    Windows Firewall is an essential security feature that protects your system from unauthorized access and threats. If it has been disabled for testing or mistakenly turned off, you can quickly re-enable it using PowerShell. This guide provides a straightforward process to restore your firewall settings and ensure a…

    Read More


  • How to Disable Windows Firewall with PowerShell

    This post provides a demo on how to disable Windows Firewall with PowerShell on a Windows computer. ⚠ Important: Disabling the Windows Firewall is not recommended as it reduces your system’s security. However, there are scenarios, such as troubleshooting, where temporarily disabling the firewall may help identify if…

    Read More


  • Best Terminal for Windows 2022

    This is a post to share an opinion on the best Terminal for Windows 2022. The answer to all our needs in the year 2022 is Windows Terminal. I have a blog post on How to Install Windows Terminal, and here is a link to the main Windows…

    Read More


  • Creating Folders (If Not Exists) with PowerShell

    If you need to create folders or subfolders in PowerShell only when they don’t already exist, this quick script will help. The script uses Test-Path to check if the folder exists before running the New-Item command. This snippet is ideal for anyone searching for a fast and reliable…

    Read More


  • How to Create New Files & Folders in PowerShell

    This is a post on how to create new files and folders using PowerShell. Creating new files and folders in Windows is generally done via GUI. That’s what it’s there for, the simplicity. But when you’re scripting or doing admin work, you might want to create new files…

    Read More


  • How To Change From WSL2 to WSL1

    This is a post on how to change a Windows Subsystem for Linux (WSL) Distribution from running on Version 2 to Version 1. WSL has two versions, the latest (2), and the original version (1). You can have many different Linux Distributions installed on your machine, and you…

    Read More


  • How to Manage S3 Buckets with AWS CLI

    This is a post on how to help manage S3 Buckets with AWS CLI, and to help explain some local Operating System (OS) considerations when running such commands. First of all, you will need to be authenticated to your AWS Account and have AWS CLI installed. I cover…

    Read More


  • Delete Files Older Than in PowerShell

    Here is an example of how to use PowerShell to delete files older than a specified date: This script will delete all files in the specified folder that have the last write time older than 30 days from the current date. You can adjust the $maxAge and $folder…

    Read More


  • Get-EventLog in PowerShell

    The Get-EventLog cmdlet in PowerShell can help you view events as you would in Event Viewer, but within your PowerShell Terminal. In this post I’ll share a few examples of use: # Get List of Event Logs Available# Show Events by Count# Show Events by Message Name# Show…

    Read More