The code for Get-DiskInventory2.ps1 is: <# .SYNOPSIS Get-DiskInventory retrieves logical disk information from one or more computers. .DESCRIPTION Get-DiskInventory uses CIM to retrieve the Win32_LogicalDisk instances from one or more computers. It displays each disk's drive letter, free space, total size, and percentage of free Listing 19.4 Get-DiskInventory.ps1, with an additional parameter Listing 19.5 Adding help to Get-DiskInventory.ps1 Specifies an additional parameter Uses a parameter Licensed to Jim Martinson <jim.martinson@ridgewater.edu> 242 C HAPTER 19 You call this scripting? space. .PARAMETER computername The computer name, or names, to query. Default: Localhost. .PARAMETER drivetype The drive type to query. See Win32_LogicalDisk documentation for values. 3 is a fixed disk, and is the default. .EXAMPLE Get-DiskInventory -computername SRV02 -drivetype 3 #> param ( $computername = 'localhost', $drivetype = 3 ) Write-Host "Disk inventory for $computername" Get-CimInstance -class Win32_LogicalDisk -computername $computername ` -filter "drivetype=$drivetype" | Sort-Object -property DeviceID | Select-Object -property DeviceID, @{label='FreeSpace(MB)';expression={$_.FreeSpace / 1MB -as [int]}}, @{label='Size(GB';expression={$_.Size / 1GB -as [int]}}, @{label='%Free';expression={$_.FreeSpace / $_.Size * 100 -as [int]}}