How to Set and Get Environment Variables in PowerShell?

get environment variable PowerShell

Recently, someone from a PowerShell community asked me about setting environment variables in PowerShell. PowerShell provides different cmdlets to do this. Let me share with you here how to set and get environment variables in PowerShell. To set an environment variable in PowerShell, you can simply use the $env variable followed by the variable name … Read more

How to Generate Random Numbers in PowerShell?

powershell random number within range

Recently, someone asked me about different methods to generate random numbers in PowerShell. I suggested different methods with examples. In this tutorial, I will show you how to generate random numbers in PowerShell with examples. To generate random numbers in PowerShell, you can use the Get-Random cmdlet. For example, to generate a single random number, … Read more

PowerShell Pipeline Variables [With Examples]

PowerShell Pipeline Variables

Recently, I gave an online session on pipeline variables for a PowerShell user group. In this tutorial, I will explain everything about PowerShell pipeline variables with examples. Pipeline variables in PowerShell, introduced with the -PipelineVariable parameter in PowerShell 7, allow you to store the output of a command within a pipeline for reuse later in the same … 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

How to Convert a String to Title Case in PowerShell?

Convert a String to Title Case in PowerShell

While working for a client, I got a requirement to convert a string to title case using PowerShell. I tried different methods for this. In this tutorial, I will show you how to convert a string to Title case in PowerShell using various methods. Title case means capitalizing the first letter of each word in … Read more

PowerShell String Replace [With Examples]

Replace Strings in PowerShell

Recently, I was doing some research on string replacements in PowerShell. In this tutorial, I have explained everything about the “PowerShell string replace” with examples. To replace strings in PowerShell using the -replace operator, you can utilize its support for regular expressions to perform versatile text replacements. For example, to standardize phone numbers in various … Read more

PowerShell: Uppercase the First Letter of Each Word

powershell uppercase first letter of each word

Recently, I got a requirement to convert the first letter of each word to uppercase in PowerShell. I tried different methods and tried to share. In this tutorial, I will show you how to uppercase the first letter of each word in PowerShell using different methods. To capitalize the first letter of each word in … Read more

How to Convert String to Camel Case in PowerShell?

Convert String to Camel Case in PowerShell

Camel case is a popular programming naming convention in which the first letter of the first word is lowercase, and the first letter of each subsequent word is capitalized, with no spaces or punctuation between words. For example, “convert string to camel case” becomes “convertStringToCamelCase.” This naming convention is often used in variable and function … Read more

How to Replace Multiple Strings in a File Using PowerShell?

Replace Multiple Strings in a File Using PowerShell

Recently, someone asked me to write a complete PowerShell script to replace multiple strings in a file. In this tutorial, I will show you how to replace multiple strings in a file using PowerShell using different methods. To replace multiple strings in a file using PowerShell, you can utilize the -replace operator in a chained … 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.