How to Get Unique Lines from a File Using PowerShell?

Get Unique Lines from a File Using PowerShell

When working with text files in PowerShell, I got a requirement to extract unique lines from a file. I tried different methods and thought to share them with you. In this tutorial, we’ll check several methods to get unique lines from a file using PowerShell. Get Unique Lines from a File Using PowerShell PowerShell is … Read more

How to Count Duplicate Lines in a Text File Using PowerShell?

Count Duplicate Lines in a Text File Using PowerShell

Recently, I was working on some text files where I was required to count the number of duplicate lines using PowerShell. I have tried different methods to do this. In this tutorial, we’ll explore different ways to count duplicate lines in a text file using PowerShell. Method 1: Using Group-Object PowerShell provides the Group-Object cmdlet … Read more

How To Create File If Not Exists In PowerShell? [4 Methods]

Create File If Not Exists In PowerShell

One of my clients recently required me to create a file if it doesn’t exist. PowerShell is the best option for this kind of requirement. In this tutorial, I will show you different methods to check for the existence of a file and create it if it doesn’t exist using PowerShell. To create a file … Read more

How to Count Words in a File Using PowerShell?

powershell count words in file

Do you need to count the number of words in a file? Check out this tutorial. In this practical tutorial, I explain how to count words in a file using PowerShell. We will explore various methods with examples. To count words in a file using PowerShell, you can utilize the Measure-Object cmdlet. First, retrieve the file content … Read more

How to Append Text to a File in PowerShell?

Append Text to a File in PowerShell

Recently, I was working with a logging application. There, I got a requirement to append text to a file in PowerShell. In this PowerShell tutorial, I will show different methods to append data to a text file using PowerShell and how to append text to a new line in a text file using PowerShell. To … Read more

PowerShell Find and Replace in File

PowerShell Find and Replace in File

Finding and replacing a file is a very common requirement in automation. In this PowerShell tutorial, I will explain in detail how to find and replace in a file using PowerShell and also I will show how to replace a line in a file using PowerShell. To find and replace text in a file using … Read more

How to search for files recursively in PowerShell?

Search for files recursively in PowerShell

Are you trying to search files inside a directory and sub-directories? PowerShell made it easy. In this tutorial, I will explain to you how to search for files recursively in PowerShell. To search for files recursively in PowerShell, use the Get-ChildItem cmdlet with the -Recurse parameter. For example, to find all .txt files in a … Read more

How to Unblock Files Recursively using unblock-file in PowerShell?

When you download files from the internet, Windows may block these files to prevent potentially harmful scripts from running on your system. This can lead to a situation where you need to unblock numerous files, which can be quite difficult if done manually. Fortunately, PowerShell offers a powerful and efficient way to unblock files in … Read more

How to Get MD5 Hash of a File in PowerShell?

Get MD5 Hash of a File in PowerShell

MD5, which stands for Message Digest Algorithm 5, produces a unique 128-bit hash value for a given data set. While MD5 is no longer recommended for cryptographic purposes due to vulnerabilities, it’s still widely used for file integrity checks. PowerShell makes it easy to compute the MD5 hash of files. In this PowerShell post, I … Read more

How to Convert Files to Base64 in PowerShell?

Convert Files to Base64 in PowerShell

Recently, while working on an automation project, I got a requirement to encode files to Base64, a process that converts binary data into ASCII string format. I will show you here different methods to convert files to Base64 using PowerShell with examples and complete scripts. To convert a file to Base64 in PowerShell, you can … Read more

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

FREE Download an eBook that contains 100 PowerShell cmdlets with complete script and examples.