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


  • The Best Terminal for Windows

    This is a post to share an opinion on the best Terminal for Windows, which is Windows Terminal. The easiest way to install Windows Terminal is by following this link which takes you to the Microsoft Store, we can one click download/install from there. Windows Terminal is installed…

    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


  • Advanced File and Folder Creation with PowerShell

    This post contains an advanced guide for creating and managing files and folders in PowerShell. It builds on the basics introduced in my previous post, PowerShell Guide: Creating Folders and Files, and includes more techniques useful for a DBA or Sysadmin. Contents: 1. Creating New Files and Folders2.…

    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. Windows Subsystem for Linux (WSL) supports two versions:> WSL2: The latest version with full Linux kernel support, offering better compatibility and performance. > WSL1: The…

    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