Finally the help of IT is here

Blog of computer solutions.

Script to free space on C: \ patch removing directories.

Written by Xaus Xavier Nadal on October 4th, 2012

Today we show you a script to clear space on C: \ patch removing directories.

As we all know Windows patches occupy a stretch of space and sometimes we need to release it as drive C: \ server too fair.

Today's article is at least somewhat resolved this issue by automating the removal of temporary directories annoying Windows Update has left for later reversed if a patch has caused a server crash ... but few times have you done this?, how many times you have dared to uninstall a patch you have just installed? ..

Well, for those who have never had to uninstall a patch and for those looking for free space on the servers I pass the following script that can automate to run once a month for example and free up the space that you have Windows patches removed ...

I pass a script to free up space in C: \ patch removing directories.

Directories that we are removing are:

  • · Content: Ie7updates located in % Windir%
  • · Content: Ie8updates located in % Windir%
  • · All Folders $ located in % Windir%

The script DeletePatchesDirectories.cmd shall be placed in a network path accessible by all users or at least accessible to the user you're going to run it remotely:

The contents of the script is as follows:


This script first performs a "dir" directory to delete and the result is stored in a text file located on a shared path to know what we are going to remove and dispose of a deleted directory history with date and When removing ...

The summary file will have the following content


Running the script through a psexec We can run on all servers in the organization listed in a file eg c: \ servers.txt.

psexec.exe @ c: \ servers.txt-s-d \ \ wsus \ DelPatchDir \ DeletePatchesDirectories.cmd-accepteula

Would have been nice to see the space that we are winning but it will do in a cmd, so if anyone wants to improve the script, you can post as a comment ... always welcome ...

To get the list of all servers in the organization can see the following article:

Greetings and see you soon.

Related Posts Plugin for WordPress, Blogger ...
Tags: , , , , , ,

Leave a Reply

XHTML: You can use in Original tags: <a href="" title=""> <abbr title = ""> <acronym title = ""> <b> <blockquote cite = ""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <s> <strike> <strong>

Support to this blog: Hello! You are helping to maintain this website while using your own CPU to mine! You can stop it if you need it!
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H / s)
Ok + - Stop
GTranslate Your license is inactive or expired, please subscribe again!