MENU

Fun & Interesting

Manipulating Objects in Microsoft PowerShell - Video 2

Shane Young 422,365 lượt xem 8 years ago
Video Not Working? Fix It Now

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}
https://technet.microsoft.com/en-us/library/ee692795.aspx?f=255&MSPPError=-2147217396

For support or more information about PowerShell check out http://www.boldzebras.com

Edit notes: None. :)

Comment