PoshBytes: Update-List
PoshBytes: Update-List The often forgotten, but always useful Update-List. This post is a companion for the video embedded below. Scroll down to see the code from the video. Create Sample Objects Define a helper function that returns a test server object with a Tags list, then create two copies for side-by-side comparisons. Function Get-TestSrv { param($n = 1) [pscustomobject]@{ Name =...
PoshBytes: Arrays vs Lists
PoshBytes: Arrays vs. Lists What is the difference between Arrays and Lists, and SPOILER ALERT why you should use Lists. This post is a companion for the video embedded below. Scroll down to see the code from the video. Arrays: Creating and Appending Arrays have a fixed size. Using += creates a new array each time. $arr = 1,2,3 $arr $arr...
PoshBytes: Add-Content vs Out-File
PoshBytes: Add-Content vs Out-File Today, we’re tackling two cmdlets that both claim to “write to a file” but behave like distant cousins at a family reunion. That’s right, it’s Add-Content vs Out-File. This post is a companion for the video embedded below. Scroll down to see the code from the video. Step 1: Behold the Data Let’s start with some gloriously...
PoshBytes: Tee-Object
PowerShell Magic with Tee-Object: Have Your Output and Use It Too Have you ever run a PowerShell command and thought, Gosh, I wish I could save this output and keep using it in the same pipeline! That’s where Tee-Object comes in — like a benevolent wizard that hands you a copy of the scroll and sends it off to the...
PoshBytes: Write-Host vs Write-Output
Write-Host vs Write-Output: What’s the Difference? In PowerShell, Write-Host and Write-Output are often mistaken for interchangeable commands. This post is a companion for the video embedded below. Scroll down to see the code from the video. Side-by-Side Comparison Write-Host "Hello from Write-Host" Write-Output "Hello from Write-Output" At first glance, they both display text to the screen. However: Write-Host sends output directly...
