0

I'd like to archive a windows.old folder off of my system to save space but don't have permissions to some of the folders in it, even when running as administrator or when running as system (using psexec -s -i).

I want to keep it in an untouched state so don't want to change any permissions / ownership. I know some backup utilities like Windows 7 backup and Acronis, etc. are able to read all files when running with elevated privileges - is there some way to do likewise or some other way to do this?

2
  • 1
    Have a look into the SeBackupPrivilege. Here is a result that might be of use: github.com/giuliano108/SeBackupPrivilege Jun 1, 2019 at 22:10
  • Thanks @HelpingHand - very helpful. I posted an answer based on your solution which uses a PS script that uses a Windows-included DLL
    – g491
    Jun 3, 2019 at 0:42

1 Answer 1

0

Thanks to @HelpingHand's comment on the question for pointing at SeBackupPrivilege which led to this solution. The benefit here is it doesn't rely on a DLL that doesn't already come with Windows.

Here's what to do:

  1. Copy the script from https://www.leeholmes.com/blog/2010/09/24/adjusting-token-privileges-in-powershell/ into a powershell script in your path called Set-TokenPrivilege.ps1
  2. Look up the Process ID (PID) of the process that you want to grant this ability to by going to the details tab of task manager. TIP: starting this process as Administrator can be helpful sometimes if making changes to files (though see also #4 and #5 below).
  3. From a PowerShell that was started as Adminstrator, run Set-TokenPrivilege.ps1 -privilege SeBackupPrivilege ##### (with ##### being the PID from the previous step)
  4. Set-TokenPrivilege.ps1 -privilege SeRestorePrivilege ##### will give you write permission to modify files, such as those that say you require TrustedInstaller permission to modify.
  5. If you need permission to modify files beyond the above such as files which say you need SYSTEM permission, you can use the downloadable psexec tool from Microsoft to start the program as SYSTEM using psexec -s -i appnamegoeshere.exe

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .