Behind the PowerShell Pipeline logo

Behind the PowerShell Pipeline

Subscribe
Archives
January 16, 2024

Building Better Strings

Let’s continue exploring other .NET classes you might want to incorporate into your PowerShell scripting. Today, I want to cover a .NET class that I know is useful to .NET developers, although I’m unsure what problem it solves for PowerShell scripters. But perhaps as we kick the tires, we’ll think of ways to use it.

Creating Strings

The goal is to create strings, often from existing variables. We can easily do this in PowerShell by leveraging variable expansion.

$Name = "GladysK"
$Time = (Get-Date).TimeOfDay
$msg = "[$Time] Running with credential $Name on $env:COMPUTERNAME <PS $($PSVersionTable.PSVersion)>"
$msg
Want to read the full issue?
GitHub Bluesky LinkedIn About Jeff
Powered by Buttondown, the easiest way to start and grow your newsletter.