How to Format Date in PowerShell [With Examples]

PowerShell Get-Date Format yyyymmddhhmmss

The Get-Date cmdlet in PowerShell is used to retrieve the current date and time. Everyone knows, but I will explain how to format data in PowerShell with examples. To format the current date and time in PowerShell as yyyymmddhhmmss, you can use the Get-Date cmdlet with the -Format parameter. The command is Get-Date -Format “yyyyMMddHHmmss”, … Read more

PowerShell Get-Date

powershell get-date

While planning for a PowerShell webinar, I prepared for PowerShell Get-Date. In this tutorial, I will explain the PowerShell Get-Date cmdlet with examples. The Get-Date cmdlet in PowerShell is used to retrieve the current date and time of the system. Simply running Get-Date without any parameters will return the current date and time in the … Read more

How to Prompt for Variable in PowerShell?

powershell prompt for variable

Someone from the team asked about the PowerShell prompt for variables. We can do this by using the Read-Host cmdlet. In this tutorial, let me explain the PowerShell prompt for a variable with some examples. To prompt for a variable in PowerShell, use the Read-Host cmdlet. The basic syntax is $variable = Read-Host “Prompt message”, … Read more

How to Trim the Last 4 Characters from a Variable in PowerShell?

powershell trim last 4 characters from variable

In PowerShell, you might need to trim the last few characters from a string for various reasons, such as processing file names, user input, or any data where the trailing characters are not needed. This is a very common requirement among PowerShell developers. In this tutorial, I’ll explain how to trim the last 4 characters … Read more

How to Trim the First 4 Characters from a Variable in PowerShell?

Trim the First 4 Characters from a Variable in PowerShell

In PowerShell, you might encounter situations where you need to trim the first few characters from a string. One of my team members has exactly similar requirements. In this tutorial, I’ll explain how to trim the first 4 characters from a variable in PowerShell using different methods and practical examples. To trim the first 4 … Read more

PowerShell New-Variable Cmdlet [With Examples]

powershell new-variable

Today, I will explain a very useful cmdlet: the PowerShell new-variable cmdlet. You will learn about the syntax and usage with various real examples. The New-Variable cmdlet in PowerShell is used to create new variables. For a basic implementation, you can create a simple variable by using the command New-Variable -Name “Greeting” -Value “Hello, PowerShell!”, … Read more

How to Trim Variable Before Character in PowerShell?

powershell trim variable before character

When working with strings in PowerShell, you might need to trim or extract parts of a string before a specific character. One of my team members received this exact requirement. In this tutorial, I’ll explain how to trim a variable before a specific character in PowerShell using various methods and practical examples. To trim a … Read more

How to Trim Variable After Character in PowerShell?

PowerShell Trim Variable After Character

While working with PowerShell variables, I got a practical requirement to trim a variable after specific characters. I have used different methods to do this. In this tutorial, I will explain how to trim a variable after a specific character in PowerShell with examples. To trim a variable after a specific character in PowerShell, you … Read more

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

100 PowerShell cmdlets download free

100 POWERSHELL CMDLETS E-BOOK

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