Scott Brandt
Members
-
Joined
-
Last visited
Reputation Activity
-
Scott Brandt reacted to Paul in Change configuration on multiple serversI've recently built this script which also identifies the serial number of the disk to fill in the ID field:
$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