Access Denied trying to uninstall assemblies from GAC

On a SharePoint 2010 development server running Windows Server 2008 R2, I had to uninstall some assemblies in the GAC and I kept getting access denied, when trying to delete them. This was the case both using gacutil.exe and the Windows Explorer when running in Administrative mode.

So, looking for at a way to do this, I had to change a Local Security Policy, in order to allow them to be deleted:

* Open Local Security Policy MMC

* Goto Security Settings -> Local Policies -> Security Options

* Locate "User Account Control: Run all administrators in Admin Approval" and change the setting from Enabled to Disabled

* Reboot and now the assemblies can be deleted

IMPORTANT! Never ever do this on a production system, and always turn it back on afterwards.