Tag Archives: 2012 R2

PowerShell: How to clean up the WinSxS folder in Windows Server 2012 R2

Windows Server 2012 R2

In this post we’ll look at how to use PowerShell to reduce the size of the WinSxS folder in Windows Server 2012 R2.

A customer has a very quick SSD based server at a cloud provider, but although it is SSD based it only has a tiny 40GB C:, which is a very small footprint for the OS, a couple of apps and logs files. So i was asked to take a look and see what i could do to make a bit of room.

The WinSxS folder contains the files for all the Windows Features you can install in the default operating system. Each time you run a windows update files in the WinSxS folder get update and the size will continue to grow.

Since Windows Server 2012 Microsoft have made it very easy to tidy the WinSxS folder up. They introduced a new feature called “Features on Demand”. Rather than the WinSxS containing all the binaries for all the features you could possibly install on the server, “Features on Demand” allows you to remove the files for features you aren’t using.

If at a later date you want to install a feature you have removed from the WinSxS folder you’ll need to specify a location for the source files.

Continue reading

How to add a USB disk to a Windows 2012 Hyper-V VM

Windows Server 2012 R2

In this post I’ll show you how to mount a USB drive inside a Hyper-V virtual machine.

If you work in an environment where USB drives are allow to be used with servers this can be quite a handy way of getting access to external storage from within a vm. It’s a very useful way of seeding initial copies of backup data.

1. Attach the USB drive to the Hyper-V host server.

Disk Management2. Right click the USB disk (in our case Disk 1) and select Offline.

Disk Manager - Disk 1 - Offline

3. Disk 1 is now offline.

Disk Manager - Offline

4. Select the vm Settings of the vm that you want to Add the USB drive to and select the SCSI Controller, highlight Hard Drive and click Add.

VM Settings - SCSI - Add Hard Drive

5. Select Physical hard disk, using the pull down menu you should see the offiline disk on the host available to you, select it and click Apply, click OK.

VM Settings - SCSI - Add Hard Drive - Physical Hard Drive

6. Within the vm start Server Manager, select the Tools menu, and select Computer Management, expand Disk Management, and you should the USB disk is offline. Right click Disk 2, and select Online.

VM Disk Management - Online

7. You can now see the disk in File Explorer on the VM and can copy data to and from it.

USB disk mounted in VM on Hyper-V

To dismount the disk perform the following steps.

1. In the VM go to Disk Management, and select Disk 2 (in this example) and set to Offline.

2. In the Settings of the VM, expand SCSI Controller, and select the Hard Drive that you have used to mount the USB disk. Click Remove, Apply, OK.

3. Right Click the USB icon in the System Tray and select Eject.

Related Posts:

1. How to Inspect and Edit virtual disks in Hyper-V

2. How to create a Hyper-V VM template without VMM

3. How to convert a Hyper-V VHDX to VMDK for VMware Workstation

4. Windows update fails on Hyper-V 2012 R2 generation 2 virtual machines

5. PowerShell: Get-ADComputer to retrieve computer last logon date – part 1