Workaround to fix Windows Server 2019 bug: Disk Cleanup / SilentCleanup Deletes Temp Folders

Microsoft Japan Windows Technology Support published a problem that temporary folders referenced by environment variable %TEMP% or %TMP% are deleted by Disk Cleanup task (SilentCleanup mode) under certain circumstances. This problem is affecting Windows Server 2019.

This bug caused temporary folders get deleted instead of just emptying it. If the folders of the environment variables %TEMP% and %TMP% are deleted, various applications related to the temporary area won’t work.

Workaround 1: Re-login Windows again

The folders that %TEMP% and %TMP% environment variables point to are created at login. A new login solves the issue.

Workaround 2: Disable Disk Cleanup in Task Scheduling

Step 1: Start command prompt (CMD) in Administrator mode.
Step 2: Run following command:
schtasks / change / tn \ Microsoft \ Windows \ DiskCleanup \ SilentCleanup / disable

Disable SilentCleanup task in Windows Server 2019
Disable SilentCleanup task in Windows Server 2019

Source

Microsoft Technet: Ask CORE: Microsoft Japan Windows Technology Support: ディスクのクリーンアップタスク (SilentCleanup) にて環境変数 %TEMP% や %TMP% に設定されているフォルダーが削除されてしまう問題について