PowerShell If Variable Contains [With Examples]

PowerShell If Variable Contains

Previously I wrote a complete tutorial on PowerShell -contains Operator. Someone in my team asked more about PowerShell if variables contains. I thought I would explain everything about it with examples. To check if a variable contains a specific value in PowerShell, you can use the -contains operator. This operator is used to determine if … Read more

How to Trim Variable Length in PowerShell?

powershell trim variable length

Recently, one of my team members was required to trim a string to a specific length while working with strings in PowerShell. I suggested various methods to do it. In this tutorial, I will explain how to trim a variable to a specific length in PowerShell with examples. To trim a variable to a specific … Read more

PowerShell Switch String Contains [With Examples]

powershell switch string

One of my team members recently searched for implementing contains in the PowerShell switch statement. This is a very important concept that PowerShell developers use. In this tutorial, I will explain everything about “PowerShell switch string contains” with examples. To check if a string contains a specific substring using a PowerShell switch statement, you can … Read more

PowerShell Random Password Generator

powershell generate random password

Recently, one of my clients asked me to create a random password generator. I suggested PowerShell for it. In this tutorial, I will show you how to create a random password generator using PowerShell. Generate Random Password Using PowerShell Now, let me show you different methods to generate random passwords using PowerShell. Method 1: Using … Read more

How to Remove Whitespace from Strings in PowerShell?

Remove Whitespace from Strings in PowerShell

While working with strings, I got a requirement to remove whitespace from strings in PowerShell. In this tutorial, I will explain several methods to remove whitespace from strings in PowerShell with some real examples. To remove leading and trailing whitespace from a string in PowerShell, you can use the Trim() method. This method cleans up … Read more

How to Remove Newline from String in PowerShell?

remove newline from string in powershell

Today, a team member asked me about removing newlines from a string in PowerShell. I suggested a few methods. In this tutorial, I will show you how to remove newline from a string in PowerShell with some practical examples. To remove newline characters from a string in PowerShell, you can use the -replace operator. This … Read more

How to Check if a String Contains a Space in PowerShell?

powershell check if string contains space

Recently, I got a requirement to check if a string contains a space in PowerShell. There are different methods to do so. In this tutorial, I will show you how to check if a string contains a space in PowerShell with examples. To check if a string contains a space in PowerShell, you can use … Read more

How to Generate Random Strings in PowerShell?

Generate Random Strings in PowerShell

Recently, a system administrator asked me about generating random strings in PowerShell. I explained different examples. In this tutorial, I will explain how to generate random strings in PowerShell with a few examples. To generate a random string in PowerShell using the Get-Random cmdlet, define the desired string length and a set of characters to … Read more

How to Increment a String Variable by 1 in PowerShell?

powershell increment string variable by 1

Recently, I got a requirement from one of my clients to increment a string variable that represents a version number in PowerShell. This is a little tricky, but there is a way to do it. In this tutorial, I will show you how to increment a string variable by 1 in PowerShell. To increment a … 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.