Hoppa till innehåll

  • Logga in via Facebook Logga in via Twitter Logga in via Windows Live Log In with LinkedIn Log In with Google      Sign In   
  • Registrera dig nu!


Make WinSxS folder smaller on Windows Server 2012

  Skriven av Göran fantomen Johansson , 04 August 2012 · 1791 visningar

After installation of Windows Server 2012 all roles and features are available in the WinSxS folder (C:WindowsWinSxS).
This means that you don’t have to have the DVD available if you want to add more roles or features to the operating system and can easily deploy more functionality to your machine.
In my case now with my Hyper-V host my WinSxS folder is 6.36GB large which of course is not big but will grow as Windows Update and more things are added over time.
Postad bild
Maybe you want to have a very slim machine or maybe you want to have a “central” WinSxS folder instead where you can get all the files needed if you need to add something sometime.
I can run the Get-WindowsFeature in PowerShell to see what roles and features are available and if they are installed or not.
This also means I can query what I currently have installed with:

Get-WindowsFeature | Where-Object -FilterScript { $_.Installed -Eq $True }

It also means I can change the filter and check if “Installed = False”.

Get-WindowsFeature | Where-Object -FilterScript { $_.Installed -Eq $False }

Now if I want to clear as much space out of WinSxS as possible and now that I ‘m not going to add more roles or features to the server (for now at least) I can take the above and send it to Uninstall-WindowsFeature to remove the components completely from the server.

Get-WindowsFeature | Where-Object -FilterScript { $_.Installed -Eq $False } | Uninstall-WindowsFeature –Remove

Note the last switch “-Remove” which is needed for the cmdlet to actually start removing the components from the WinSxS folder
Now after sending that command it takes a while to complete but after it has removed all components from the folder and it has reduced in size
Postad bild
Next time you want to add more things to the server you have to specify where Windows needs to look for the files needed for installation. It can be the original DVD, a WIM-file, Windows Update…
Postad bild
If you again run the command “Get-WindowsFeature” you can on the right side see if the component is Installed, Available (Where before) or Removed (As they are now).

I hope you like what you read here on the blog.
I love feedback so don’t hesitate to write a line or two!!!