Actually, what I've done is install windows 7 on my old XP machine, and since I went x64 and used to have x32, there was no upgrade path.
I used the User State Migration Tool (USMT) to move a lot of stuff, and for the stuff it moved, it fixed the file/directory ACLs, but not everything. Quite a bit of data was just left sitting on the drive.
All that leftover data has ACLs that were relevant to the XP system. In particular, most files are owned by the primary user account of the old system.
So how can I replace one SID in the ACLs with a new one, remapping all the permissions from the old user to the new user?
I used
icacls <path>\* /save aclfile /t
to create a backup of all the permissions. Had to run as an administrator, or icacls couldn't read the ACLs to save them.Originally I wanted to use:
icacls /restore aclfile /substitute <oldsid> <newsid>
, but it won't work because it can't figure out the username for oldsid.So I just used a text editor, and brute force replaced all the references to in the aclfile with
Then used
iacls <path> /restore aclfile
to put the new permissions back.