Wednesday, 22 January 2020

command line - In Windows 10 can ProgramData/.../SystemData Folder be emptied of contents without consequence?




  • Would like to know if I can safely delete the contents of the C:\ProgramData\Microsoft\Windows\SystemData folder, all folders and files there in.

  • It seems that these folders may be auto generated, and mainly are named by User Account Security Identifier's, so deleting them may be harmless.

  • Or at least is it safe to delete all files with the del /s star dot star command leaving the sub-folder structure.

  • The purpose is to flush the cache for the lock-screen stored at this location so that the default images at C:\Windows\Web\Screen will come into effect.



Example Code; delete folders and file contents:


RD C:\ProgramData\Microsoft\Windows\SystemData /S /Q

Example Code; Delete only files within folders:


Del /s /q C:\ProgramData\Microsoft\Windows\SystemData\*.*

Current Research:


How do you delete all the files but not the directories in a folder?


SU - Retrieve Custom Windows 10 Lock Screen Image


SU - How to override the default Windows 10 lock screen image for all users?


Pastebin - Set Lockscreen for windows 10


ss64 - RD


ss64 - Del



Answer




In regards to: C:\ProgramData\Microsoft\Windows\SystemData


Changes to this folder can corrupt Windows Spotlight from working again please backup system before trying to make various offline hacks for the lock screen and login screen.



How to use Task Scheduler to run System Task in Windows 10



It seems that this location is used for storing lockscreen cache organised by user, deleting the images in the location is used by thewindowsclud, while deleting the folders in the directory is only found in one pastebin hack solution.


I have not found any way to easily take ownership of the folder and revert the permissions so have instead found a simple way to run the task as System.





  1. Save a batch file ClearSystemDataCache.cmd with the following (this relates to above question, otherwise make script to be run by system):


    Del /s /q C:\ProgramData\Microsoft\Windows\SystemData\*.*




  2. Run taskschedular as admin




    • Name the task --> Clear SystemData Cache *(or name of task)




    • Change User or Group --> Advanced --> Find Now --> Scroll Down Select 'System' --> OK --> OK




    • Tick 'Run with Highest Privileges'




    • Under actions tab browse and select ClearSystemDataCache.cmd




    • Set up an automatic triggers under triggers tab, such as on unlock.




    • Click --> OK --> OK






  3. Now can right click on task and 'Run' or wait for set trigger.




  4. This task can be also exported as an xml file and imported into other computers.




No need to use takeown or icacls to make these system changes.


Reading:


SO How do you run CMD.exe under the Local System Account?


Edugeek - 10 holding onto cached lock screen images?


Thewindowsclub - How to remove Lock Screen images history from Windows 10


Microsoft Forum - LockScreen Cache not updating


Pastebin - Set Lockscreen for windows 10


SU - Is there a way in which I can use takeown to apply ownership to every directory on the drive?


Questions:


SU - How to use Icals & Takeown to make changes and reset in Windows 10


SU - 'Access Denied' how to revert permissions - icacls and takeown


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...