Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

Storage Sense doesn't enable #53

Closed
zerolagaux opened this issue Jan 9, 2018 · 1 comment
Closed

Storage Sense doesn't enable #53

zerolagaux opened this issue Jan 9, 2018 · 1 comment

Comments

@zerolagaux
Copy link

zerolagaux commented Jan 9, 2018

When I would run the script and have my presets file to enable storage sense, it would give a general error. I used a cleanly installed 1709 machine to test it and figured out what the issue was. If this isn't the proper place for code changes I'm sorry, first time using Github to submit anything. But the code to fix the issue is this...

# Enable Storage Sense - automatic disk cleanup - Not applicable to Server
Function EnableStorageSense {
	Write-Host "Enabling Storage Sense..."
	If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense")) {
		New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense" | Out-Null
	}
	If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters")) {
		New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters" | Out-Null
	}
	If (!(Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy")) {
		New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" | Out-Null
	}
	Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "01" -Type DWord -Value 1
	Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "04" -Type DWord -Value 1
	Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "08" -Type DWord -Value 1
	Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "32" -Type DWord -Value 0
	Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy" -Name "StoragePoliciesNotified" -Type DWord -Value 1
}

No changes are required to the disable function, only the enable function. Apparently, on a brand new installed PC, the StorageSense registry entry doesn't even exist. The first time you open the Settings area and click "On" for Storage Sense it creates the folder, subfolders and keys. I just simply look for them and create them, then set the default registry entries that the settings menu did. Hope this helps.

@Disassembler0
Copy link
Owner

This is the proper place for code changes and both your analysis and remediation are correct. I'll add the fix later today. Thanks for the report.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants