Jump to content

Scott Brandt

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by Scott Brandt

  1. Thank you, Paul. This saved me a fair bit of guess and check.

     

    On 9/15/2020 at 7:23 AM, Paul said:

     

    
    $query = 'SELECT VolumeSerialNumber FROM Win32_LogicalDisk where DriveType=3 AND Name=''' + $env:SystemDrive + ''''
    $serialNumber = (gwmi -Query $query).VolumeSerialNumber
    
    $count = 0
    
    # rule 1: < 5000MB - Elevated
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('Id' + $count) -Value $serialNumber
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('Percentage' + $count) -Value '15' # not used
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('Priority' + $count) -Value '2' # elevated
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('SizeMB' + $count) -Value '5000'
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('UsePercentage' + $count) -Value '0'
    $count = $count + 1
    
    # rule 2: < 2000MB - Critical
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('Id' + $count) -Value $serialNumber
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('Percentage' + $count) -Value '15' # not used
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('Priority' + $count) -Value '3' # critical
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('SizeMB' + $count) -Value '2000'
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name ('UsePercentage' + $count) -Value '0'
    $count = $count + 1
    
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\HDDList' -Name 'Count' -Value $count
    Set-ItemProperty -Path 'HKLM:\SOFTWARE\MMSOFT Design\PC Monitor' -Name 'SendNotificationOnLowHDDSpace' -Value '1'

    -Paul

     

×
×
  • Create New...