Search this site
Embedded Files
breakingpwsh.com
  • Home
  • Articles
    • Fun with Start-Job... Lots of 'em
    • What would "/" or "\" do if they did an action similar to "|"?
    • -ComputerName Has Left the Building
    • For My VDI Admins - Horizon Pool Reports
    • -Verbose Inception
    • Big Thx to r/PowerShell
    • Breaking .CompareTo()
    • Replacing Text On a Bigger Scale
    • FunctionCmdletBroken
    • Creating A PSCustomObject
    • Write-Host -ForegroundColor "MixEmUp"
    • PWSH Snippets - ISE vs. VSCode
    • Start-Transcript Is Too Loud
    • Fixing the Get-Member cmdlet
    • Test-path -IsValid -IsBroke
    • BEGIN/PROCESS/END - You Can Do Better
    • breaking Get-ChildItem Return Types
    • Shallow Copy vs. Deep Copy
    • Write-Host vs Write-Output - The Final Argument
    • If() is Weird
  • WTF is the point of this?
    • breakingpwsh
breakingpwsh.com

Fun with Start-Job... Lots of 'em 

I use the cmdlet Start-Job and the parameter -AsJob pretty often in scripting. If I have a lot of iterative processing, then assigning each iteration to its own job really saves a lot of time. Say I have to check every computer...

What would "/" or "\" do if they did an action similar to "|"?

Had a dumb idea a few weeks ago. What would "/" or "\" do if they did an action similar to "|"?


Maybe backslash runs the left command the same number of time....

-ComputerName Has Left the Building

When I first started transitioning over to pwsh version 7, I noticed that a very common parameter was missing from some very common cmdlets. Well - I noticed it when ....

For My VDI Admins - Horizon Pool Reports

When managing a domain, whether you are a one-man shop or one of many in a large enterprise, generating reports with pointed information is.....

-Verbose Inception 

Now that you're in this far, let's talk about how to use complicated code to make verbose even better. If you're not familiar with what "-Verbose" is, just try these cmdlets for a good...

Big Thx to r/PowerShell 

Just wanted to throw a quick thanks to the people of r/PowerShell. I put a post on there tonight just to show off this project I've been working on. Fully expecting downvotes and no interaction - and I was very...

Breaking .CompareTo()

The CompareTo() method does just what it sounds like - compare 2 objects and determine the order of the 2 objects. It was created to have an easy way to compare versions of applications, scripts, whatever. So if you're scrip.... 

Replacing Text On a Bigger Scale 

One of the curses of getting better at a skill, is that you eventually get the knowledge to look back at wha.... 

Function or Cmdlet or Broken? 

I wanted to do some clarifications on the details of pwsh modules and the files that make them up. In the manifest file, there are also some gotchas....... 

Creating A PSCustomObject 

Creating custom objects is the most efficient way to work with data from different sources. If you need to collect info on a virtual server in a vCenter, being able to combine data from AD and from..... 

Write-Host -Foreground Color "MixEmUp" 

Quick one here to make output in the terminal a bit more readable to the user running the script. In a recent cmdlet I built, before the PROCESS block is run, the values of all the variables are out.... 


PWSH Snippets - ISE vs. VSCode 

Creating snippets for PowerShell is a great way to up your efficiency. I completed the first draft of a project recently that required almost 200 separate function files. Each of those files...


Write-Host vs Write-Output The Final Argument 

So, if you have been using PowerShell for more than a few months (or hours likely), you've definitely used the Write-Host cmdlet. I would also bet that you have discovered the Write-Output cmdlet - probably even used it.....


Fixing the Get-Member cmdlet 

Lets make a new cmdlet. A simple one, to make a current cmdlet work like even a PWSH novice would expect it to. I'll build a new cmdlet that calls the Get-Member cmdlet, but makes a .....


Test-path -IsValid -IsBroke 

I recently found a new parameter in an old cmdlet I had not noticed before - and it doesn’t work. The Test-Path cmdlet does just that - tests that the path to a file or directory points to an existing object. The -IsValid parameter....


BEGIN/PROCESS/END - You Can Do Better 

When creating advanced functions or cmdlets, the processing always follows the same basic flow. Blocks of code are processed starting with block BEGIN, then PROCESS, followed by END.

Start-Transcript Is Too Loud 

There are 2 problems with the Start-Transcript cmdlet. First, unlike most other cmdlets, assigning the output of the cmdlet only returns a string that the transcript was started, not an object. Most com...


Shallow Copy vs. Deep Copy 

Ran into a new problem today that somehow I have never had before. I created a PSCustom object to work with some XML. After collecting the data into the custom object, and then those objects into an array, I created a new variable ($newList) and assigned it the value of the original object ....

If() is Weird 

Working on a project this week I noticed that if() doesn't work exactly like I always thought it did. Of course, the normal way everyone expects is if the expression in the parens evaluates to true, then take the action the script block. But what I noticed is that the eval in the parens doesn't have to be "true".....

Breaking Get-ChildItem Return Types 

I have always seemed to have issues working with objects returned from Get-ChildItem. There was always some type of formatting that had to be done to the path string to use it in whatever next cmdlet I was.....

breakingpwsh.com is poorly written/created/designed/cutpasted by Steve Landry. Certifiable automation specialist and Lord of VDI.
Twitter
Reddit
GitHub
LinkedIn
Stormwind Studios
Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse