How to remove installed updates. Using the command line. Why are updates needed?

As you know, when installing Windows updates, update files are first downloaded to system folders, and after installing the updates... they remain there. Therefore, the size of the Windows folder is growing all the time. Over the course of a year, the folder grows by 6-10 GB. The same thing happens when you install programs whose distribution is made in the form msi file. And this is in addition to the mass temporary files, which are created during installation. I think you know how to delete temporary files.

How to deal with update files that are not so easy to find and delete manually, and often even impossible, since they are located in protected folders?

Where can I find update files?

All updates for Windows and a number of other programs are delivered to the user’s computer in the form of msi or msp files. After downloading from the Internet, they are stored in the folder C:\Windows\SoftwareDistribution\Download. And after installation necessary for the system files are placed in hidden folder "c:\Windows\Installer".

The folder C:\Windows\SoftwareDistribution\Download can be cleaned manually or by writing simplest file With bat extension or cmd and placing the line in it:

del c:\Windows\SoftwareDistribution\Download\* .* / f / s / q

del c:\Windows\SoftwareDistribution\Download\*.* /f /s /q

The folder is also growing "c:\Windows\Prefetch". The files that are stored in the prefetch folder contain information about the applications that run on the computer. This information is used Prefetch service for more quick launch programs again. If you frequently install and uninstall various programs and applications, the prefetch folder is full unnecessary information, which is no longer used in any way, but simply takes up space on the hard drive. Accordingly, if you delete all content prefetch folders, That necessary information the programs will be written into it again, and the unnecessary ones will be deleted forever. If you completely delete all files from the prefetch folder, the first boot of Windows 7 after deletion will be slightly slower while programs re-enter their data.

vssadmin delete shadows /All /Quiet

Saved bat file with these 3 lines you can connect it to the Task Scheduler and run it according to schedule.

What about the c:\Windows\Installer folder?

As we said, this folder grows as a result of installing programs and updates. And its contents cannot be deleted just like that, because some of the data is later used to delete what was installed. But some of the data is useless. For example, some updates are replaced by others, more complete, and the old ones are no longer needed. How to clean this folder correctly without damaging anything?

I for a long time I use it at work unique program PatchCleaner. This utility detects such unused useless files, which are called orphaned. How does she find them? Using WMI queries to the system, you can get a list of installed installers and patches and then compare it with the list of files in the Installer directory.

The utility can be used in the mode command line via CLI ( Command Line interface). By running the utility with the /d switch, it will automatically detect all unnecessary files and delete such files. As you remember, after installation you can also add it to the scheduler and run it, for example, once a month after installing updates.

It works great with all versions Windows Vista. The only condition for operation is .Net Fframework 4.5.2 installed. By the way, the utility has a portable version.

What should not be deleted?

Folder C:\Windows\WinSxS, or Windows Side by Side, has been present in the OS since Windows XP. Microsoft has created a system that allows you to save several versions of the same libraries (DLLs) and, if necessary, use exactly the one that a specific program requires. The folder is intended to protect users from the not entirely direct hands of some programmers. During installation, some programs try to replace Windows DLL files with their own, which is not always good and can lead to system failure. Microsoft has solved this problem. Windows sends the program's dll file to WinSxS, and the program considers that everything has been replaced and works quietly. Windows, in turn, also continues to work quietly.

In short, there is no need to delete the contents of this folder. What can you do with it? Yes, Windows 8.1 and newer versions support compressing this folder. How this can be done is described in the Microsoft article on TechNet.

WinSxS, or Windows Side by Side, is another innovation in Windows XP. Microsoft has created a system that allows you to save several versions of the same libraries (DLLs) and, if necessary, use exactly the one that a specific program requires. The folder is intended to protect users from the not entirely direct hands of some programmers. During installation, some programs try to replace Windows DLL files with their own, which is not always good and can lead to system failure. Microsoft has solved this problem. XP sends the program's dll file to WinSxS, and the program considers that everything has been replaced and works quietly. Windows, in turn, also continues to work quietly.

Update operating system- This is good. However, sometimes the adage “perfect is the enemy of good” comes into play, causing a system that is supposed to be more productive to suddenly begin to behave strangely. Often installed modifications are to blame.

Let's look at how to remove Windows 7 updates if they are causing your system to malfunction or if they simply take up too much space.

Removal

If you installed Windows 7 and subsequently encountered incorrect updates, execute the following actions:

Open "Control Panel", go to the "Programs" section. Click on the "View installed updates" link.
A list of modifications that have been installed on your computer will appear. All of them are sorted by product type - you are interested in "Microsoft Windows".
You can select and uninstall any modification. The main thing here is not to make mistakes.

There cannot be any automatic updates in Windows XP, since Microsoft no longer supports this operating system.

However, if necessary, remove everything unnecessary updates You can use the Add/Remove Programs function. You just need to check the “Show updates” option so that they are displayed in a list and become available for deletion.
If you want to get rid of the latter installed modifications, use the system restore function. Roll back the system to its previous working state, but be careful: if, for example, you installed drivers on Windows 7 after a checkpoint, they will be lost. The same applies to programs, so it is recommended not to get carried away with system rollbacks.

The WinSxS directory is a kind of repository for old versions of system files that are unnecessary after the next update. These files are needed so that, if necessary, you can roll back the system to a higher level. early state. Sometimes this is useful - for example, if an update “breaks” the system.
However, in most cases, the files from this folder lie like dead weight, taking up a lot of space (from 5 GB and above). Let's see what we can do with this directory in Windows 8 and 7 to clean up our hard drive a little.

Important! Windows 7 must have SP1 or KB2852386 installed, otherwise the cleanup feature will not have the required settings.

As part of this cleaning, all files that were installed more than a month ago are destroyed.

In Windows 8 and 8.1, this procedure is no different. In this way you will get rid of all unnecessary files, which take up space, so be sure to use it at least once a month.

As you can see, Windows developers They are well aware of the shortcomings of their system and try to correct them. Perhaps in the tenth version there will be additional functions, allowing you to get rid of unnecessary files, but we will learn about this a little later.

Microsoft has no plans yet to release a second service pack for Windows 7, but this does not mean that the company will stop releasing updates for the most popular PC OS.
In October, Microsoft released a number of updates for its users, some of which led to one update that all Windows 7 fans have been waiting for for a very long time.
Recently, instead of releasing a full-fledged service pack, Microsoft released the "Disk Cleanup" application for Windows users 7 SP1, allowing you to clean WinSxS folder from old files. The application is available for download from Windows Update and has a status of "Important" but not "Critical".
It's about updating KB2852386, which allows you to remove outdated updates (updates that have been superseded by newer ones) using a new option in the standard cleanup wizard Windows disk 7 – Windows Cleanup Tool (cleanmgr.exe) .

Let us remind you that in Windows 7, when installing any system update, system files are replaced by new ones, and their old versions are stored in the directory WinSxS(C:\Windows\WinSxS). Thanks to this approach, you can safely remove any system update at any time.
However, this approach leads to the fact that over time, as new updates are installed, the directory WinSxS significantly increases in size (it turns out that the greater the age of the system and the large quantity updates installed - topics larger size WinSxS folders), which cannot but worry users, especially happy owners SSD drives and disks with a small system partition size.
Previously missing from Windows 7 standard utility deleting outdated files was updated, so to reduce the size of the WinSxS folder you had to resort to various tricks. What about Windows 8?

In Windows 8 and 8.1, the Cleanup Wizard outdated updates(Windows Update Cleanup) is a standard feature.

How to clean the WinSxS folder in Windows 7 by removing outdated updates

Note. It is important to understand that after performing Disk Cleanup using of this master, it will be impossible to uninstall updates that replaced removed updates.

Windows 7 Service Pack 1

Download Windows 7 Service Pack 1 is available from the Microsoft website(Windows 7 SP 1 download page)

You can also download Windows 7 Service Pack 1 using the direct link:

1) For 32-bit Windows 7 you can download SP1 (515 MB)

2) For 64-bit Windows 7 you can download SP1 (866 MB)

3) It is possible to download a universal (x86, x64) and ISO image of Service Pack 1 for Windows 7 (1.9 GB)

It is worth noting that Windows distribution 7 Service Pack 1, which can be downloaded from the links provided, contains 36 languages, including Russian and English.

Cleaning the disk from temporary files SP1

And now the best part: we clean the HDD from temporary files that are created during the OS update process. These files can take up to 0.5 GB of space.

Why are these files needed? They are intended for the event that you want to remove SP1 from the system. But, most likely, you are not going to do this, and therefore, we do not need these files - that’s why we are getting rid of them.

Note: If you follow the steps below, you will not be able to delete SP1. otherwise than by reinstalling the system. It is also not recommended to perform the following steps if you have a beta version of SP1 or Windows 7 installed

Instructions

Pay attention to the system notification about the update process - usually before installing them, a dialog box appears where you can select further actions. Also, when downloading operating system updates, you will see a corresponding icon in the panel of programs running in background, there you can stop downloading by double-clicking on it.

Open My Computer. Go to local disk on which the operating system was installed, then open WINDOWS folder. Next, be very careful not to confuse the names - open SoftwareDistribution and then Download. From the latter, delete all existing files and restart your computer. Windows may issue a warning that deleting these files may affect the entire system, click Continue.

If in the future you do not intend to install updates for your operating system or you want to do it manually, open the “Control Panel” through the “Start” menu. Open Security Center. At the very bottom of the window that opens, you will see a list of three items; open the last one, which is called “Automatic".

Select the mode for downloading and installing updates, here you have the choice of either setting this process to automatic execution, disable it completely, notify the user about available updates, but do not download or install them. There you can also configure other parameters.

If you have updateable software in addition to the operating system, select the update download mode during installation, if such an item is available in initial settings. You can also change the mode by opening the program settings; Often the path to the folder containing downloaded program updates is also indicated there.

note

Make sure you don't really need these updates.

Helpful advice

Disable auto mode download updates and manually download the add-ons you need.

Automatic is used for timely downloading and installation of new drivers and detailed information for existing devices. To provide proper operation equipment, it is recommended to download and install updated software on time. But there are situations when to use automatic update undesirable.

Instructions

The easiest way to protect your computer from various threats is to enable automatic updates. But there are updates that most users try to avoid. These include, for example, the KB971033 update, which is used to verify the authenticity of the operating system. To avoid similar situations, install new drivers and updates selectively. To do this, when Windows messages about the availability of new software, select “Custom installation”, open the window with the found files, uncheck “unwanted” updates and complete the installation.

To completely disable automatic updates, open the “My Computer” menu, click right click mouse, select “Properties”. In the window that appears, open the “Automatic Updates” tab and check the “Disable automatic updates” option, click the “Apply” button.

After you disable the update, you will see a Windows alert. To get rid of it, go to the Start menu, open Control Panel. Next, select “Security Center”, open last tab"Change how Security Center notifies you" and uncheck "Automatic updates". This will turn off the annoying notification about possible risks.

Now all you have to do is disable the automatic update service directly. Go to “Start”, go to “Control Panel”. Open the "Administration" menu, click on the "Services" shortcut. Next in the list, find the “Automatic Updates” item, right-click on it and select “Properties”. Set the Startup Type to Disabled and the Status select Stop.
Thus, automatic updates will not occur on yours.

Often, updating the operating system has a positive effect on the operation of the computer. However, in some cases it is necessary to roll back changes for one reason or another. If you are absolutely sure that adverse changes in the operation of your computer occurred due to the installation of update files, delete them.

Instructions

If before installing updates there was a check Point system recovery, open the list of standard utilities. Select the recovery utility.

Any update, especially if it affects system files, is a potential threat to system stability. Despite the fact that updates are tested both by Microsoft, and by administrators themselves, situations where installing an update leads to complete system inoperability happen from time to time. What to do in this case? We will talk about this in this article.

The main problem, which is also an undoubted advantage, of Windows systems is their diversity. Number of possible combinations hardware and the software running on it is almost impossible to count, therefore, no matter how carefully you test updates, there can always be a combination of hardware and software that turns out to be incompatible with a given update. Most often the problems are related to third party drivers or low-level software running at the kernel level.

A separate discussion concerns unlicensed systems. Most often, activation is bypassed by patching and replacing the kernel. This in itself is unsafe and fraught. potential problems, and with updates affecting the kernel, you risk a system failure, which has happened more than once. Various amateur builds available on the Internet are also susceptible to this drawback; many builders immediately include a patched kernel in the system or forcefully launch the activator immediately after installation, without checking the presence and validity of the system key.

This happened last Patch Tuesday. Next update security KB3045999 for Windows 7 when rebooting it resulted in " blue screen death" (BSOD).

Users burst out with further reproaches to Microsoft for releasing “buggy” updates, but it soon became clear that only systems with a patched kernel were susceptible to the error. Nevertheless, the problem also affected completely law-abiding users who were too lazy to assemble it and, in order not to download gigabytes of updates, simply downloaded a suitable assembly from the network.

We will not discuss the moral and legal aspects of using unlicensed software, let everyone decide this issue on their own, but rather consider ways to restore the system.

Installation disc or Windows PE

This is the most accessible, although not the easiest, method. Anyone will do disk from compatible system, the only condition is compliance with the bit depth. You should also remember about backward compatibility, i.e. For Windows recovery 7, you can use disks not only from Windows 7 and Server 2008 R2, but also from Windows 8 / Server 2012. In some cases, you can try using a disk from more early system, but not all features may be available; for example, it will not be possible to implement the instructions below with a disk from Windows Vista / Server 2008.

If you are using Windows PE, then it must also be based on current version OS or later, the bit depth must also match.

Let's boot from installation disk and on the screen prompting you to install the OS, select the item System Restore.

The utility will detect the installed OS and offer to go to automatic recovery system, there are few options here, so click Further.

But there is absolutely no need to wait for the wizard to finish his work, especially since he won’t be able to help us, so on the next screen we click Cancel.

Then take your time and select the link in the window that appears Show additional features system recovery.

Now you have the opportunity to exit to the command line, which you should use.

If you booted from Windows PE, you will be taken to the command line immediately.

Then you should clarify which letter you received system disk. With standard markup, this will be the letter D, the letter C will be the service section. To check, let's do:

Once you are sure that this is indeed the system disk, you can proceed to next steps. Before doing this, it would be nice to clarify the name problematic update, as a rule, this is easy to do using the Internet. Then we get a list of all installed packages with the following command:

DISM /Image:D:\ /Get-Packages

In the output we find the number necessary update and copy the package name, if it is unknown, then delete all packages with the date of the last update.

To copy the name of a package on the command line, select it and press the key Enter, just right-click to insert.

To remove a package, run the command:

DISM /Image:D:\ /Remove-Package /PackageName:Package_for_KB3045999~31bf3856ad364e35~amd64~~6.1.1.1

where as an option PackageName specify the package name obtained in the previous step.


Microsoft Diagnostics and Recovery Toolset

A set of diagnostic and recovery tools ( Microsoft Diagnostics and Recovery Toolset, MSDaRT) - a tool based on ERD Commander from Sysinternals and available through Software Assurance (SA) but can be easily found online. To work with Windows 7 you will need at least version 6.5 of MSDaRT, version 8.0 is current

We boot from the MSDaRT disk, remember that compliance with the bit depth is a mandatory requirement, and on the first screen, after selecting the language (in our case, version 8.0 is used), select Diagnostics:


Then Microsoft Diagnostics and Recovery Toolset:


After which a window with a choice will open in front of you available tools, we are interested in Hotfix Uninstall or Removing patches.

Working with the wizard is not difficult; select one or more updates and delete them:

As you can see, working with MSDaRT is much more convenient than with the command line, but it requires preparing for possible emergency situations in advance.

In both cases, after removing the problematic update, you should reboot and carefully analyze the reasons for the failure. We hope that this material will help you quickly restore system functionality after an unsuccessful update.