Category Archives: beginner series

18Oct/17

Using PowerShell To Split A String Without Losing The Character You Split On

Last week, I wrote a post on the difference between .split() and -split in PowerShell. This week, we’re going to keep splitting strings, but we’re going to try to retain the character that we’re splitting on. Whether you use .split() or -split, when you split a string, it takes that character and essentially turns it into the separation of the two items on either side of it. But, what if I want to keep that character instead of losing it to the split?

Continue reading

11Oct/17

What’s the difference between -split and .split() in PowerShell?

Here’s a question I see over and over and over again: “I have a string and I’m trying to split it on this part, but it’s jumbling it into a big mess. What’s going on?” Well, there’s splitting a string in PowerShell, and then there’s splitting a string in PowerShell. Confused? Let me explain.

Continue reading

04Oct/17

PowerShell Rules For Format-Table And Format-List

In PowerShell, when outputting data to the console, it’s typically either organized into a table or a list. You can force output to take either of these forms using the Format-Table and the Format-List cmdlets, and people who write PowerShell cmdlets and modules can take special steps to make sure their output is formatted as they desire. But, when no developer has specifically asked for a formatted output (for example, by using a .format.ps1xml file to define how an object is formatted), how does PowerShell choose to display a table or a list?

Continue reading

27Sep/17

The Difference Between Get-Member and .GetType() in PowerShell

Recently, I was helping someone in a forum who was trying to figure out what kind of object their command was returning. They knew about the standard cmdlets people suggest when you’re getting started (Get-HelpGet-Member, and Get-Command), but couldn’t figure out what was coming back from a specific command.

Continue reading

13Sep/17

Piping PowerShell Output Into Bash

With Windows 10, you can install Bash on Windows. Cool, right? Having Bash on Windows goes a long way towards making Windows a more developer-friendly environment and opens a ton of doors. The one I’m going to show you today is more of a novelty than anything else, but maybe you’ll find something neat to do with it.

Continue reading

23Aug/17

Getting Started With Azure Automation (Pluralsight Course)

I try my best to make new technical posts on this blog every Wednesday morning. They vary in length, skill level, and sometimes even usefulness. Today I wanted to share that my first Pluralsight course was published last week: Getting Started with Azure Automation.

 

Pluralsight is a paid service but trials are available, and it’s a benefit of having an MSDN subscription. They’ve got thousands of hours of good stuff for people working in all areas of technology, including my new course.

 

My Getting Started with Azure Automation course will take you from zero knowledge to functionally useful in just over an hour. Please check it out and don’t hesitate to contact me with any questions or feedback.

 

As a Pluralsight author, I am compensated for creating courses so this is technically a sponsored post. I do, however, truly believe in their service overall, and think many people who read my blog may benefit from watching my course.

09Aug/17

Add A Column To A CSV Using PowerShell

Say you have a CSV file full of awesome, super great, amazing information. It’s perfect, except it’s missing a column. Luckily, you can use Select-Object along with the other CSV cmdlets to add a column.

In our example, let’s say that you have a CSV with two columns “ComputerName” and “IPAddress” and you want to add a column for “Port3389Open” to see if the port for RDP is open or not. It’s only a few lines of code from being done.

Continue reading