Windows 10: Schedule a task to periodically delete certain folders of non admin user

Discus and support Schedule a task to periodically delete certain folders of non admin user in Windows 10 Network and Sharing to solve the problem; Hi friends, I have a windows 10 home premium computer with two users, one admin controlled by me and one non-admin user that I want to make for... Discussion in 'Windows 10 Network and Sharing' started by PrashantDesaiHN, Oct 25, 2020.

  1. Schedule a task to periodically delete certain folders of non admin user


    Hi friends, I have a windows 10 home premium computer with two users, one admin controlled by me and one non-admin user that I want to make for friends. The user will be local to my computer. I want to accomplish two things:
    1 every 48 hours I want a powershell script to run that will delete Downloads, Desktop, Music, Pictures and Videos folders of the non-admin user.

    2 Every day at 11:00 PM I want a powershell script to run that will log off the non-admin user if not already logged off.


    I have tried to do the following:

    I created a powershell script like this

    Remove-Item -Path $env:UserProfile\Downloads\ -Recurse -Force
    Remove-Item -Path $env:UserProfile\Desktop\ -Recurse -Force
    Remove-Item -Path $env:UserProfile\Pictures\ -Recurse -Force
    Remove-Item -Path $env:UserProfile\Videos\ -Recurse -Force
    Remove-Item -Path $env:UserProfile\Music\ -Recurse -Force

    Saved it as remove-folders-48hrs.ps1 in C:\program_files\Windows Powershell\scripts\ C:\ of admin user


    Then I created the following task:

    Schedule a task to periodically delete certain folders of non admin user afab25af-f908-48f7-9374-87ea88d81258?upload=true.png


    Schedule a task to periodically delete certain folders of non admin user ede01fbe-1196-449b-bf16-41337153e0ff?upload=true.png


    Schedule a task to periodically delete certain folders of non admin user 5ebcad0c-3908-40e0-a88e-f5783e89e324?upload=true.png


    Schedule a task to periodically delete certain folders of non admin user 6963fcb6-7c85-4b6f-970a-6e68d8f07489?upload=true.png


    Schedule a task to periodically delete certain folders of non admin user 4ef359e5-d194-46a0-b862-d0ee481cdd05?upload=true.png


    Schedule a task to periodically delete certain folders of non admin user 6cd4a3c7-bc13-4879-8207-2efc13978de1?upload=true.png

    Update: I changed the username to sam_and_jimmy.


    Its not deleting the folder contents. I see the task running but when I log into the non-admin user the files are still there.


    I haven't even tried to make the log off script work.


    Any help on this will be greatly appreciated.


    Thank you very much

    :)
     
    PrashantDesaiHN, Oct 25, 2020
    #1
  2. RajDT Win User

    Windows 2016 - Scheduled Task Access for non-admin Domain users

    Hi,

    We are unable to provide access on scheduled tasks for non-admin domain users. This is doable in windows 2012 by adding the permissions to C:\Windows\System32\Tasks folder but it is not working in windows 2016.

    How do we handle this in windows 2016 ?

    Thanks
     
    RajDT, Oct 25, 2020
    #2
  3. Task scheduler user account list includes user accounts that have already been deleted from the computer.

    Thanks for providing the results of the troubleshooting steps we provided. Since the credentials are still showing up in task scheduler, we suggest that you follow the steps below to check the entries in the credential manager and delete the entries manually:

    • Type the words Credential Manager in Cortana or the search box.
    • From the list of results select Credential Manager
    • From this screen, you can manage Web Credentials and
      Windows Credentials
      .

    Once you have the screen open verify if any of the credentials you saw in task scheduler is present and manually delete them.

    Regards.
     
    Jordan Dom, Oct 25, 2020
    #3
  4. Tryx3 Win User

    Schedule a task to periodically delete certain folders of non admin user

    where user account for running the tasks are stored? How to delete and edit them?

    John,

    Task scheduler records both the computer name & user name in its Author
    field, hence me-pc/me, but only the username me in the field for
    When running the task, use the following user account. That is its normal behaviour and not a sign of any fault.

    When intending to alter the user name for a task, always open Task scheduler as Admin or it will object to any change.

    [Right-click on the shortcut to Task scheduler & select Run as Admin.]

    You can delete user accounts in Settings, Accounts, family & other users. If the user account entries in the dropdown list have already been deleted then that is a caching issue & I suggest you post another question called something like
    Task scheduler user account list includes user accounts that have already been deleted from the computer. In your question text, include the dropdown list picture to avoid any misunderstandings.

    Denis
     
    Tryx3, Oct 25, 2020
    #4
Thema:

Schedule a task to periodically delete certain folders of non admin user

Loading...
  1. Schedule a task to periodically delete certain folders of non admin user - Similar Threads - Schedule task periodically

  2. PROVIDE ADMIN ACCESS TO CERTAIN USERS FOR CERTAIN FOLDERS ONLY

    in Windows 10 Gaming
    PROVIDE ADMIN ACCESS TO CERTAIN USERS FOR CERTAIN FOLDERS ONLY: I have an issue with a particular program, it has two different locations and an asmuwrapper.exe file with a user access control lock on it, so when users print from this application, it prompts for an AD account login. the work-a-around has to be replaced this file with one...
  3. PROVIDE ADMIN ACCESS TO CERTAIN USERS FOR CERTAIN FOLDERS ONLY

    in Windows 10 Software and Apps
    PROVIDE ADMIN ACCESS TO CERTAIN USERS FOR CERTAIN FOLDERS ONLY: I have an issue with a particular program, it has two different locations and an asmuwrapper.exe file with a user access control lock on it, so when users print from this application, it prompts for an AD account login. the work-a-around has to be replaced this file with one...
  4. PROVIDE ADMIN ACCESS TO CERTAIN USERS FOR CERTAIN FOLDERS ONLY

    in AntiVirus, Firewalls and System Security
    PROVIDE ADMIN ACCESS TO CERTAIN USERS FOR CERTAIN FOLDERS ONLY: I have an issue with a particular program, it has two different locations and an asmuwrapper.exe file with a user access control lock on it, so when users print from this application, it prompts for an AD account login. the work-a-around has to be replaced this file with one...
  5. Task Scheduler - How to to grant non-admin users the permission to view and run a scheduled...

    in Windows 10 Gaming
    Task Scheduler - How to to grant non-admin users the permission to view and run a scheduled...: We use role based access and currently have local groups for all users and admins on a Windows 2016 Server.The role membership includes AD groups where AD members are added.The QA team members are non-administrators and access the QA server using RDP.Our QA team members need...
  6. Task Scheduler - How to to grant non-admin users the permission to view and run a scheduled...

    in Windows 10 Software and Apps
    Task Scheduler - How to to grant non-admin users the permission to view and run a scheduled...: We use role based access and currently have local groups for all users and admins on a Windows 2016 Server.The role membership includes AD groups where AD members are added.The QA team members are non-administrators and access the QA server using RDP.Our QA team members need...
  7. Task scheduler asking users for admin credentials

    in Windows 10 Software and Apps
    Task scheduler asking users for admin credentials: I'm a system administrator and have an application .exe that I need to run when a standard user logs in, but with elevation. I have tried doing this with both Powershell and the Windows Task Scheduler using tips I've found online, however when I log in as a standard user I...
  8. Task scheduler asking users for admin credentials

    in Windows 10 Gaming
    Task scheduler asking users for admin credentials: I'm a system administrator and have an application .exe that I need to run when a standard user logs in, but with elevation. I have tried doing this with both Powershell and the Windows Task Scheduler using tips I've found online, however when I log in as a standard user I...
  9. Deleted task scheduler task

    in Windows 10 Customization
    Deleted task scheduler task: Hi,I Accidentally deleted StartComponentCleanup in Task Scheduler. Is it possible to recover or re-create the deleted task? https://answers.microsoft.com/en-us/windows/forum/all/deleted-task-scheduler-task/0866d10b-9ef7-4bb7-8f0a-56b848500fa9
  10. Scheduled task spills into the next period

    in Windows 10 Customization
    Scheduled task spills into the next period: I have a task in Windows 10 Task Scheduler that runs every hour. The task is running a Java JAR, and it's actually taking longer than an hour. Task Scheduler is terminating the task run when it reaches an hour and starting the next run. Is it possible to not terminate any...