Powershell

Careful with Arrays

With PowerShell you never know whether a cmdlet returns an array or a single object. That’s because PowerShell automatically wraps results in an...

read more

Get Volume IDs (Part 2)

In Windows 10 and better, you can use Get-Volume to get volume IDs and other information about your drives: PS> Get-Volume DriveLetter...

read more

Get Volume IDs (Part 1)

You can query WMI to get a list of your drives volume IDs like so: Get-CimInstance -ClassName Win32_Volume | Select-Object -Property DriveLetter,...

read more

Beware of -match

The -match operator is frequently used in scripts however not everyone seems to understand how it really works. It can be a really dangerous filter...

read more

Avoid Add-Member (Part 3)

In the previous tip we looked at a number of clever alternatives to avoid Add-Member when creating your own new objects. While using hash tables to...

read more

Avoid Add-Member (Part 2)

In the previous tip we looked at creating simple data objects, and it became evident that instead of using Add-Member, you can cast a hash table to...

read more

Avoid Add-Member (Part 1)

Often the cmdlet Add-Member is used to create simple objects like this: $user = New-Object -TypeName psobject | Add-Member -MemberType NoteProperty...

read more

Important Keyboard Shortcuts

Two of the most important keyboard shortcuts in any PowerShell environment – whether console, ISE, or VSCode – are TAB and CTRL+SPACE. TAB triggers...

read more

Logging Variable Types

As part of your debugging and quality control you may want to log the data that gets assigned to individual variables. For example, you may want to...

read more

Creating World Map Graphs

If you have data related to countries, you may want to visualize and highlight this geographic data. Classic bar- and chart-graphs won’t always work...

read more

Downloading Files

Simple file downloads can be done in a variety of ways, i.e., using Invoke-RestMethod, Invoke-WebRequest, or via the BitsTransfer module. If you...

read more
1 2 3 351