P
PrashantDesaiHN
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:
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
Continue reading...
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:
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
Continue reading...