Delete content of all users Download folders

Hi ,
I checked in the forum for that but did not find anything that can suits my issue.
I need to delete all the content of all users download folder every night .
I tried this
%userprofile%\Downloads | where {($_.LastWriteTime).AddDays(1) -lt (get-date)} | remove-item -force -recurse
but  it does not help.
Could you please help me or put me in the right direction .
Thanks
AGYL

Hi ,
I checked in the forum for that but did not find anything that can suits my issue.
I need to delete all the content of all users download folder every night .
I tried this
%userprofile%\Downloads | where {($_.LastWriteTime).AddDays(1) -lt (get-date)} | remove-item -force -recurse
but  it does not help.
Could you please help me or put me in the right direction .
Thanks
AGYL
You are using what looks like PowerShell mixed with batch.  % variables do not exeisits in PowerShell they are in the form of $env:USERPROFILE.  That variable is only valid for the currently logged in users.  It is not global.
Normally we would do this with Group Policy and not with a script.  Yu can do it with a GP scheduled task or on every login.  Contact you Administrator to set this up for you.  If you decide to do this centrally then you will also need your
network Admin to help you.  You will need to design a method that fits your network.
If you do not have an Admin trained in Windows Networking then you can try and contact a consultant or you can take time to study the learning materials until you understand how Windows and scripting work.  The links on the top of this page are a good
place to start.
¯\_(ツ)_/¯

Similar Messages

  • IPhone mail : cannot reply, forward or create messages.  Can only delete a message by using the individual slide at the continue arrow.  The icons/controls "Delete" "Reply" "reply All" Flag" Download - .... all gone - they have disappeared.  Help.

    3G Iphone - Verizon: I cannot reply, forward or create messages.  Can only delete a message by using the individual slide at the continue arrow.  The icons/controls "Delete" "Reply" "reply All" Flag" Download - .... all gone - they have disappeared.  Help.

    Restart your iPhone. If that's not work repeat the Reset (Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.)

  • Emptying all users' temp folders

    Hello everyone
              Right now we're having problem with low disk space on Terminal Server. Actually we have applications which
    help us to get rid of all temp files easily, I mean without going to C:\Users\USERNAME\AppData\Local\Temp and deleting files manually These are
    Profiles Scanner 
    ICSweep
              But these applications cannot remove any item just because I do not have permission to Edit this folder
    inspite of fact I’m belonging to Domain Admins group. I can break security of a userfolder, but it is quite time consuming. There're about 700+ userfolders in  C:\Users\ folder. Moreover, we have a lots of trojan name "DWH****" (**** is
    random number, like 3D25, 5C68). And this file seems duplicate itself into different name and that's why we have low disk space error on our Terminal Server.
              So my question is How do I empty C:\Users\USERNAME\AppData\Local\Temp folder without changing the security
    on userfolders? I tried to empty through GPO (Computer Configuration > Windows Settings > Folders) but I couldn’t get this work.
              Thanks in advance

    Hi,
    As per my research, you can try some script to delete all users’ temporary files\folders. For that providing you script link which you can use and modify as per your requirement. Please refer below article for detail information.
    1.  Delete Temp files
    2.  What is the Command to Delete Temp files for all User profiles in a Local
    3.  Use PowerShell to Clean Out Temp Folders
    Hope it helps!
    Thanks,
    Dharmesh

  • ITune 10 Deleted Content in ALL my Playlists

    Although my library is fine, the new iTunes 10 emptied all of the content from ALL of the playlists I made (weeks of work). What happened to my playlists and short of re-entering every darned one of them, is there any way to get them back? This was a horrible and frustrating upgrade. Now I can't sync any of my iPods because iTunes will erase the only record of my playlists I have!

    I had the same problem. Called Apple support and the customer service person was worthless. She made it sound like the most obvious thing in the world that playlists would be deleted with 'all downloads of itunes.' Said there is nothing I can do, and that if I sync my iphone, I'll lose my playlists from there, too. Fantastic.

  • Powershell Command to permanently delete items in ALL users Deleted Items folder older than X days.

    Does anyone know a powershell command that can be run on Exchange 2010 SP1 that will permanently delete mail in the deleted items folder older than X days for ALL users in a specific database? This should include any user created subfolders in deleted items
    also.
    I know that seems bizarre to have user created subfolders in deleted items but we have found that users have discovered that if they create subfolders then their deleted items dont get purged at the regular retention period time.
    Thank You.

    Hi,
    For Exchange 2010 SP1, we can use search-mailbox and new-mailboxexportrequest to delete message in certain folder.
    Understanding Exchange Search
    http://technet.microsoft.com/en-us/library/bb232132.aspx
    Xiu Zhang
    TechNet Community Support

  • Firefox 3.6.10 crashes when I open it, even after uninstalling, deleting the default profile and all user appdata folders.

    Firefox was working fine, but recently it's just stopped working. It instantly comes up with the error message 'Firefox Has Stopped Working'. I have pasted the error message below
    Problem signature:
    Problem Event Name: BEX
    Application Name: firefox.exe
    Application Version: 1.9.2.3909
    Application Timestamp: 4c8fdcc5
    Fault Module Name: StackHash_8228
    Fault Module Version: 0.0.0.0
    Fault Module Timestamp: 00000000
    Exception Offset: 8a101e70
    Exception Code: c0000005
    Exception Data: 00000008
    OS Version: 6.1.7600.2.0.0.256.1
    Locale ID: 2057
    Additional Information 1: 8228
    Additional Information 2: 8228e43d426cfb63ad023de96d440ede
    Additional Information 3: 1853
    Additional Information 4: 1853d009ebe0b1df5f24e024bd05eb79
    I really have no idea why this is happening. I have a feeling it may be some sort of virus or malware but i've done scans and nothing has come up. Internet Explorer is working fine. I'm on Windows 7.

    This can happen if adware  Genieo is installed without your knowledge. Removing it will help,
    1. Download and use free AdwareMedic to remove the adware
        http://www.adwaremedic.com/index.php
        Install , open,  and run it by clicking “Scan for Adware” button   to remove adware.
        Once done, quit AdwareMedic.
                   or
        Remove the adware  manually  by following the “HowTo” from Apple.
        http://support.apple.com/en-us/HT203987
    2. Safari > Preferences > Extensions
         Turn those off and relaunch Safari to test .
         Turn those on one by one and test.
    Note:
      If you don’t have another browser installed,
    startup into SafeMode, log into your account
    and download  AdwareMedic or the removal instructions from Apple.
    Follow these steps to start up into Safe Mode.
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup sound, press and hold the Shift key. The Shift key should be pressed as soon as possible after startup, but not before the startup sound.
    Release the Shift key when you see the Apple logo appear on the screen.
    After the Apple logo appears, it may take longer than usual to reach the login screen. This is because your computer is performing a directory check as part of Safe Mode.
    To leave Safe Mode, restart your computer without pressing any keys during startup.
    Source:    http://support.apple.com/en-us/HT203987

  • Firefox deleted everything and all back up folders

    I opened Firefox today and everything was gone. I went into my profile folder to look for my backups,
    C:\Documents and Settings\me\Application Data\Mozilla\Firefox\Profiles\xxx.default
    and there are no backups! No bookmarkbackup folder, nothing. All Extensions are gone.
    I never deleted anything from Firefox. I never touched that folder. I never uninstalled, and re-installed FF, I did nothing. I just opened it up today and everything is gone, and the backups are completely gone.
    I accidentally closed Firefox and when I went back the back up folder reappeared and contained nothing other than backups for today from the session I just ended. Nothing older than that.
    I assume I am literally screwed here. It held all my work bookmarks, which aren't exactly easy to find again.

    Just discovered that when i go to C:\Users\Me\Desktop all my folders and files are there. I can drag them to restore them but it still sheds no light on why all my programs are uninstalled or why all my bookmarks are gone

  • Everyone Deny Delete ACL on all user preferences

    Hi, I know that user accounts have an ACL on certain folders to prevent them being deleted, but on one of my users this ACL has appeared on all his preferences files and folder, and they are all explicit so I can't just change the enclosing folder and propagate to remove them.
    does anyone know a terminal command I could use to remove all of these because at the moment if the user tries to change any application preferences the app will crash on quit.

    This has happened to 50+ accounts on my file server as well, on accounts that were created only 2 weeks prior. I'd like to find out why this happens and how to prevent it.
    I find myself having to hand edit perms, which is a huge pain.

  • Missing all user-installed Apps after restore after failed 3.1.3 upgrade

    I upgraded my 3G to 3.1.3. iTunes (9.0.2.25 on Windows 7 PC) first backed up the iPhone and then proceeded with the upgrade, which failed (never had this happen before) and forced me to do a restore from the latest backup. After the restore, I seem to have all my data in the native apps, but all user-downloaded apps are missing. I expected them to be present after the restore... No???? I didn't keep apps synced back to my iTunes previously. Are they all lost?

    Update: I see ~370 megs of 'Other' usage and expect that to be my apps... but don't see any apps still.

  • HT1923 This article contains the only thing that worked for me.  I also had to sign out of iCloud and uninstall it.  Then I had to delete all files and folders from all of those applications that were under Program Files, Program Files x86, and Users.

    This article contains the only thing that worked for me.  I also had to sign out of iCloud and uninstall it.  Then I had to delete all files and folders from all of those applications that were under Program Files, Program Files x86, Program Data and Users.  My iPhone 4 will now sync with iTunes both in its USB-connected  mini dock and over Wi-Fi.  It's unfortunate (negligent programming on the part of Apple?) that the upgrade to iTunes 11 did not remove all of those files as part of the upgrade process. 

    I am having the same issue....Same address for years - same as USPS - I tried 5 times (3 macs and 2 iPhones) and now i have 5 CHARGES for 1.00 each on my credit card. I took the credit card info off so they don't charge me anymore. How can they charge me yet still not allow me to download free updates and say I have an invalid address? I'm sure I will spend weeks or months trying to get a credit out of these incompetent idiots.

  • Downloaded free game for my iPad 2; made several in-app purchases. The game no longer works, it's happen to all users (customers). Deleting and re-downloading refreshes the game to level 1. How can I get a refund?

    Downloaded free game for my iPad 2; made several in-app purchases. The game no longer works, it's happen to all users (customers). Deleting and re-downloading refreshes the game to level 1. How can I get a refund?

    You can contact iTunes and ASK for a refund. Then make make an exception to their all sale are final policy.
    Refunds from the App Store or iTunes - Apple Club
    In the future set the restrictions so that in-app purchases are prohibited and that a password is always required.
    iOS: Understanding Restrictions

  • When U2 launched their latest album it was downloaded to all iTunes users free of charge.  It does not seem to be possible to delete any or all of these tracks.  Can anybody tell me how to delete these tracks?

    When U2 launched their latest album it was downloaded to all iTunes users free of charge.  It does not seem to be possible to delete any or all of these tracks.  Can anybody tell me how to delete these tracks?

    Hi SJHocking,
    Welcome to the Apple Support Communities!
    If you would like to remove the iTunes gift album “Songs of Innocence”, please follow the instructions outlined in the attached article. 
    Remove iTunes gift album "Songs of Innocence" from your iTunes music library and purchases - Apple Support
    Cheers,
    Joe

  • How do i delete all my music folders?

    I have just got a new laptop and the people in store moved my music from my old laptop to my new one. They managed to create 2 of everything and now I can't sort it out. I have tried uninstalling apple to reinstall it but it just saved all my previous libraries so I have the same problem! Can i delete all my music folders and start again from scratch? Please help? I am not very IT literate so need all the help I can get?

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    If you have an iOS device that syncs with contact & calendar data on your computer you should migrate this information too. If that isn't possible create a dummy entry of each type in your new profile and iTunes should offer to merge the existing data from the device into the computer, otherwise the danger is that it will wipe the information from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library, or a backup of it, then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data. If you don't have any Apple devices then see HT2519 - Downloading past purchases from the App Store, iBookstore, and iTunes Store.
    tt2

  • How to delete all files and folders (with files) in IsolatedStorage.

    Hi awesome programmer:-) The code I have to clean up the local folder doesn't work properly so I won't even bother posting it here. I basically want to have a "master reset" option to remove all new created files and folder in the local folder.
    Can you give me simple code to remove all files/folder so the app goes back to the state it was when the user installed it for the first time? Thanks in advance. ps I were able to delete a directory(-ies) with this method:
    private async void DeleteDirectory(string directoryName)
    try
    var folder = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFolderAsync(directoryName);
    if (folder != null)
    await folder.DeleteAsync();
    this.Dispatcher.BeginInvoke(delegate()
    txtUpdateFeed.Text = "Folder < " + directoryName + " > deleted.";
    catch (Exception ex)
    this.Dispatcher.BeginInvoke(delegate()
    txtUpdateFeed.Text = "Delete Directory << " + directoryName + " >> Error: " + ex.GetBaseException().Message.ToString();
    It seems to work, I have not tested with all conditions though. Anyway let me put up the code so you can see I have been trying: This is to delete everything but not all files are deleted:
    private void WipeAllData(bool bln)
    try
    txtUpdateFeed.Text = "Removing files...";
    if (bln)
    txtUpdateFeed.Text = "Removing folders...";
    //Delete videos directory
    DeleteDirectory("videos");
    //Delete pictures directory
    DeleteDirectory("pictures");
    txtUpdateFeed.Text = "Folders removed.";
    //Delete the rest of the files
    var iso = IsolatedStorageFile.GetUserStoreForApplication();
    foreach (string name in iso.GetFileNames())
    iso.DeleteFile(name);
    BtnWipeAllData.Content = "Wipe All Data";
    VideoCameraPowerValue = "on";
    BtnVideoCameraPower.Content = "Video Camera: ON";
    PhotoCameraPowerValue = "on";
    BtnPhotoCameraPower.Content = "Photo Camera: ON";
    txtUpdateFeed.Text = "Files removed successfully.";
    catch (Exception ex)
    MessageBox.Show("Wipe All Data Error:\n" + ex.Message.ToString());
    Why isn't all files being deleted?

    Hi Clint William Theron,
    Based on your descriptions, I know that when you run the above code, it does not delete all the files, then have you checked that which kinds of files or in which folder the files can not been deleted?
    Besides, if you want to let the app go back to the state it was when the user installed it for the first time, then an easy way is to uninstall and reinstall it.
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • My users folder has 140GB used on it, but I cannot find where it is getting that calculation. I went through all of my folders and opened them all in an info panel, and they all come out to about 30GBs. Where is the rest of the data? -Using Mountain Lion

    My users folder has 140GB used on it, but I cannot find where it is getting that calculation. I went through all of my folders and opened them all in an info panel, and they all come out to about 30GBs. Where is the rest of the data? -Using Mountain Lion

    First, empty the Trash if you haven't already done so.
    Use a tool such as OmniDiskSweeper (ODS) to explore your volume and find out what's taking up the space. You can delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one.
    Proceed further only if the problem hasn't been solved.
    ODS can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    Install ODS in the Applications folder as usual.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Triple-click the line of text below to select it, then drag or copy — do not type — into the Terminal window:
    sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    Press return. You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up.
    I don't recommend that you make a habit of doing this. Don't delete anything while running ODS as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means.
    When you're done with ODS, quit it and also quit Terminal.

Maybe you are looking for

  • Maintenance view Vs Table maintenance

    Hi, I would like to know the dif between T.Maintanance And Maintenance view. As we know as per the def we know Maintenance view will be used to maintain a table. But I have never created any M.view for the same. However we use Table maintenance gener

  • IHome no longer works with iPhone 4s after iOS 6.1 update.

    My iHome no longer works with iPhone 4s after iOS 6.1 update.  Prompts message 'This accessory is not supported by iPhone'.  Has anyone come accross this and is there a fix?

  • Current library, new ipod- what will happen?

    I am thinking of exchanging my 2 week old ipod for a new one b/c it has frozen 3 times already, althougth it has been easily reset. The store people ( circuit city) reccomended that I do so. What will happen when I plug in my new ipod to the itunes s

  • Newby Question: Can AIR app have BOTH use HTML and Flex?

    I need to make a desktop app using HTML and JavaScript but I want 99% of the logic to be written in Flex.  Is that possible? Also, do I need to buy Flash in order to compile Flex?  Or does AIR SDK include a compiler? Pete

  • I can't get the metronome figured out

    even when I uncheck it, it keeps clicking away! it's driving me nuts!