What will happen if I delete software distribution folder when a cumulative or any other update is being installed or waiting for a restart?

Mathirajan Elumalai 20 Reputation points
2023-07-21T17:10:19.3966667+00:00

I want to run the below steps in PS script remotely in some devices that have very low disk space:

First,

Stop the windows update service [ net stop wuauserv ] and the Background Intelligent Transfer Service [ net stop bits ]

Second,

Delete all contents of Software Distribution Folder to free some space since the concerned device only has 10GB C:\ drive free space

Third,

Start the windows update service [ net start wuauserv ] and the Background Intelligent Transfer Service [ net start bits ]

Fourth,

Run this command in cmd:

Dism.exe /online /Cleanup-Image /StartComponentCleanup

What will happen when I perform these steps when windows update is in the middle of installing a cumulative or some other updates or when it is waiting for a restart in windows 11 and windows 10?

If this will cause a problem, is there a way to detect if any updates are being installed or a update restart is pending in PowerShell?

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. S.Sengupta 24,636 Reputation points MVP
    2023-07-22T00:36:50.3033333+00:00

    It is safe to delete the Software Distribution folder.The Software Distribution folder, which temporarily stores files needed to install new updates. It's safe to clear the content of the said folder because Windows will always re-download and re-created all the necessary file and components, if removed.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.