posts-powershell

Create Text Reports with Format-Table

Format-Table is a great cmdlet to output formatted data. Sometimes, you may just be interested in the raw table data. You can simply hide the column...

Sort With PS Code

Sort-Object is a great and versatile cmdlet to sort anything you want. Simply specify the property or properties you want to use for sorting: Dir...

Displaying First Or Last Elements

Select-Object can limit results to only the first or last elements. Simply use -first or -last: dir | select-object -first 10Get-Process |...

Splitting Text Into Words

If you ever need to read in a file and split file content into words, there are a couple of gotchas to keep in mind. First off, remember that...

Passing ByRef vs. ByVal

Usually, when you assign a variable to another variable, its content is copied. Here is an example: $a = "Hello"$b = $a$a = "Hello...

Ejecting CDs

PowerShell can still use COM libraries. Simply use New-Object -comObject and provide the COM library name to load it. With this approach, you can do...

PowerShell Essentials: Get-Member

Get-Member is the third important basic PowerShell cmdlet as it gives you a documentation of what a command returns. It lists all of the object and...

PowerShell Essentials: Get-Help

Get-Help is the second of the three most important PowerShell cmdlets as it retrieves all the Help for any cmdlet. If you just enter Get-Help, you...

PowerShell Essentials: Get-Command

There are only three cmdlets you should know by heart. One is the Get-Command, which can do a lot more than you might think. When called without...

Create PowerShell Shortcuts

If you ever wanted to create shortcut icons on your Desktop, or in your programs menu, to quickly launch PowerShell, here is a way to do it:...

Preserving Alias Definitions

Maybe you have invested some time in creating new aliases, and now you would like to know how to preserve your new aliases so that the next time you...

Deleting Aliases

As you may know aliases are shortcuts to other commands. So, you can easily add new aliases like this: Set-Alias edit notepad.exe The next time you...