r/PowerShell • • 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

11 comments sorted by

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.

0

u/o-Festive-Mambo Jun 17 '26

see that's the thing though. i'm the only user acc in the device.