Author Posts

November 15, 2017 at 9:28 am

the advice is "grab the file from Morelunches" but it is not included in the tool-codelistings.zip downloaded.

November 15, 2017 at 9:43 am

I typed it out (it works) but found some typos in the original (There was no ` after {$OK=$True})

Function Get-DiskInfo {
    Param (
        [string]$computerName='localhost',[int]$MinimumFreepercent=10
    )
        $disks=Get-WmiObject -Class Win32_Logicaldisk -Filter "Drivetype=3"
            foreach ($disk in $disks) {$perFree=($disk.FreeSpace/$disk.Size)*100;
            if ($perFree -ge $MinimumFreepercent) {$OK=$True}`
            else {$OK=$False};$disk|Select DeviceID,VolumeName,Size,FreeSpace,`
            @{name="OK";Expression={$OK}}
}}
Get-DiskInfo

Does this look like acceptable formatting per the book?