Author Posts

November 5, 2015 at 1:13 pm

I want to run a nightly PS script that will remove all the values from this key like so, but not the key itself:

Remove-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\PurgeAtNextLogoff\* -whatif

Is this the correct statement?? whatif returns nothing...

My understanding is that the * prevents deleting the key itself (PurgeAtNextLogoff).

Thank you, Tom

November 5, 2015 at 1:30 pm

I believe you are looking for Remove-ItemProperty. See: https://technet.microsoft.com/en-us/library/dd315394.aspx

November 5, 2015 at 1:38 pm

Yes, that's it but it wants a name parameter and I only want to delete the values not the key itself.

Thank you...

November 5, 2015 at 1:43 pm

I got it:

Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\PurgeAtNextLogoff\ -name s* -whatif

Thank you for pointing me in the right direction!!