Manipulating Objects with PowerShell

Manipulating Objects with PowerShell

Update: 2016-11-15
Share

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.

Comments 
loading
00:00
00:00
1.0x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Manipulating Objects with PowerShell

Manipulating Objects with PowerShell

Shane Young