Show-CSpace

My latest Prof. PowerShell column has a function that takes a computername as pipelined input. It then returns a custom object showing free space on drive C:\. The point of the column was to demonstrate how to make a function behave like a cmdlet and take pipelined input so it’s not necessarily the most glamorous function I’ve ever written.

Anyway, the function got mangled in formatting for the web.  This is what it should be:

Function Show-CSpace {
  Begin {}
  Process {
    $c=Get-WmiObject win32_logicaldisk -filter "deviceid='c:'" -computername $_
    $c | Select-Object @{name="Server";Expression={$_.__SERVER}},Size,FreeSpace
  }
  End {}
}

Download a text file with the function here.