r/PowerShell • u/o-Festive-Mambo • Jun 17 '26
Solved Keept getting SetAccessControl error even though my account is administrator on all side
Be forgiving with me because i'm not very technical with this, but I've tried using script to tweak some videogame files, used to work fine but the newer version cannot run its function. everytime i tried to run it the error line below always shows up.
" Exception calling "SetAccessControl" with "1" argument(s): "Attempted to perform an unauthorized operation."
I always started my powershell in admin, and I run this file through a PS.1 extension, any idea on how to fix it? link to the program.
0
Upvotes
View all comments
Show parent comment
1
u/dodexahedron Jun 17 '26
You still want to reset profile folder ownership to the correct account when finished. It's trivial to take ownership when you need to.
Even better would be to simply grant full access to the folders to the administrative user you use, so you don't have to take ownership to do whatever you need to do..
Take ownership, grant full control, then reset ownership back to the user.