edwardscott Posted September 24, 2020 Posted September 24, 2020 I am try to clear out everyone's download folder that logs into our WVD which we have set a 15 users.I run this PS script but it only clears the download folder for who is logged in.Remove-Item -Path $env:UserProfile\Downloads\*.* -Recurse -ForceI am sure it just needs tweaking but I can't seem to figure it out.Any help would be great thanks!
AlexB Posted September 24, 2020 Posted September 24, 2020 (edited) get-childitem c:\users | % { "c:\users\" + $_.Name + "\Downloads" } or get-childitem c:\users | % { "c:\users\$($_.Name)\Downloads" } This will just echo back the full path, but should give you enough the expand with Remove-Item commands (I don't want to post the exact command as it is a bit dangerous if folks copy and paste) Edited September 24, 2020 by AlexB
edwardscott Posted September 24, 2020 Author Posted September 24, 2020 Hi I am knew to PS and have tried different ways to expand the Remove-Item command and not getting it.Would you mind send me the way to get it done directly to my email? This would be greatly appreciated and would help be learn how it works. [email protected]
AlexB Posted September 25, 2020 Posted September 25, 2020 (edited) PM sent. For those that need to put it together in the future, wrap "c:\users\$($_.Name)\Downloads\*" with either side of Remove-Item -Path and -Recurse -Force (needs running as admin) Edited September 25, 2020 by AlexB
danflynn Posted October 20, 2020 Posted October 20, 2020 What we ending up doing for WVD Multi-Session hosts was putting the access group into the local Guest group on the host with a group policy (Computer Configuration\Preferences\Control Panel Settings\Local Users and Groups\). What this does is when the user logs out the data in the user profile is removed from the host basically making it a non-persistent profile. The one downside we did find with this is that all Microsoft Store based apps don't work as they can't be opened with a Guest use. The big one was calculator had to find a legacy calculator app (https://winaero.com/get-calculator-from-windows-8-and-windows-7-in-windows-10/). Could use a logoff script to delete the downloads that runs as the user but they would have access to delete their own downloads
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now