Manipulating Objects with PowerShell

Sign in to queue

Description

This is part 2 of a series on using PowerShell. In this video, we cover how to work with Objects in PowerShell. We do that by breaking down this script.

Get-PSDrive | ?{$_.Free -gt 1} | %{$Count = 0; Write-Host "";} { $_.Name + ": Used: " + "{0:N2}" -f ($_.Used/1gb) + " Free: " + "{0:N2}" -f ($_.free/1gb) + " Total: " + "{0:N2}" -f (($_.Used/1gb)+($_.Free/1gb)); $Count = $Count + $_.Free;}{Write-Host"";Write-Host "Total Free Space " ("{0:N2}" -f ($Count/1gb)) -backgroundcolor magenta}

So if you have ever wanted to understand what all of that is and how to write your own crazy script this is the video for you.

Here is a link to better understanding the .NET formatting method. {0:N2}

For support or more information about PowerShell check out Bold Zebras.

Embed

Download

Download this episode

The Discussion

Add Your 2 Cents