0

We have an RDS server with dozens of user profiles and I am trying to run cleanup scripts to get rid of some old software folders from the users C:\users*username\appdata\local\softwarenamedfolder However I get access denied errors when trying to run my script When I try to browse to said folders it gives me a popup saying I have no permissions click continue to get them

I tried running the following in powershell

icacls "C:\users" /grant "Domain Admins":F /t

and now it no longer pops up when clicking the username in C:\users, however the appdata folders for each user still do not have the permission set

What can I use to iterate through EVERY SINGLE FOLDER in C:\users and add the domain admins group will full control?

  • Won't help, because when you're using the GUI or an unelevated command line your membership of the Domain Admins group is disabled by User Account Control (UAC). See, e.g., this article. Your scripts should work as-is, without making any permissions changes, provided you run them from an elevated (run "as administrator") command prompt. (Of course that assumes there is nothing unusual about the permissions on your server.) – Harry Johnston Apr 26 at 22:09
0

1) This is bad practice. 2) I do something similar where I give a backup administrator rights to the users folders so that I can do granular restore using Windows Backup. Just do what you're doing (more or less) but put it in a login script and the user themselves will run the script for you on login or as a scheduled task. Or add a line to give admins rights to each users folder on login, then automate a task that will do your cleanup task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.