ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Cleanup Script for USERS folder

    IT Discussion
    windows 7 windows 8 windows 8.1 windows 10 active directory domain
    5
    17
    3.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gjacobseG
      gjacobse
      last edited by

      I have been stewing on this for a bit,.. but I was asked if there was a way to clean up the Users folder (C:\Users* ) of old profiles.

      The computers use folder redirect, so changes are on the server, but for what ever reason, he wants the folder to be empty other than the active user.

      Is this a bad idea or 'acceptable'.

      And it just struck me on how to simply do this,.. using either part of the logon or logoff script option in ADUC. I know that you can use WHOAMI or %USERNAME% to determine the active user.

      1 Reply Last reply Reply Quote 1
      • scottalanmillerS
        scottalanmiller
        last edited by

        So you want to continuously delete anything that users leave behind? Why leave the active user, since if someone else sits down, even for a second, that active user will be deleted too. Leaving the active user's data around would just confuse people as to why sometimes their data persists and sometimes it does not. That would be really dangerous.

        gjacobseG 1 Reply Last reply Reply Quote 0
        • gjacobseG
          gjacobse @scottalanmiller
          last edited by

          @scottalanmiller
          I agree - and would think that deleting it in the first place would be dangerous as well.

          scottalanmillerS 1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @gjacobse
            last edited by

            @gjacobse said:

            @scottalanmiller
            I agree - and would think that deleting it in the first place would be dangerous as well.

            Deleting everything is dangerous, but only a little. After a day or two, no one will make mistakes around where they store files. That's not so bad. Making the deletions confusing and capricious will make users mad, confused and almost certainly set them up for data loss that will be blamed on IT. I would only do that if you have management put, in writing, that they understand that this will socially engineer their users for extreme data loss and that IT absolutely advises against it.

            It's the business' call, but it is crazy, IMHO.

            1 Reply Last reply Reply Quote 0
            • gjacobseG
              gjacobse
              last edited by

              What of in the case of employees who have left - But that seems either a long task, or one that is tied into pulling User from ADUC. Seems more like a PS script than a 'simple' .bat or .vbs script...

              scottalanmillerS 1 Reply Last reply Reply Quote 1
              • scottalanmillerS
                scottalanmiller @gjacobse
                last edited by

                @gjacobse said:

                What of in the case of employees who have left - But that seems either a long task, or one that is tied into pulling User from ADUC. Seems more like a PS script than a 'simple' .bat or .vbs script...

                The local system has no way to know who has left. I would likely do that manually and only when necessary. Seems a bit mental to auto-delete what might be critical files with no one to inspect them.

                gjacobseG 1 Reply Last reply Reply Quote 2
                • scottalanmillerS
                  scottalanmiller
                  last edited by

                  Sounds like a client that might need to think about central storage for this stuff. Then there is only one copy of each user's data, it can be archived and cleaned up easily.

                  1 Reply Last reply Reply Quote 0
                  • gjacobseG
                    gjacobse @scottalanmiller
                    last edited by

                    @scottalanmiller

                    Seems a bit mental...

                    Yes - yes it is.... And yes,.. Yes he is..

                    1 Reply Last reply Reply Quote 1
                    • scottalanmillerS
                      scottalanmiller
                      last edited by

                      Oh, is it the nutter who got fired and then begged for service.... just do what's asked, don't worry about lost data.

                      1 Reply Last reply Reply Quote 0
                      • Reid CooperR
                        Reid Cooper
                        last edited by

                        This feels risky. Is there much chance of there being important files on the user's desktops?

                        gjacobseG 1 Reply Last reply Reply Quote 0
                        • Reid CooperR
                          Reid Cooper
                          last edited by

                          What about instead of deleting the data, it was zipped up and send to the manager?

                          gjacobseG 1 Reply Last reply Reply Quote 0
                          • gjacobseG
                            gjacobse @Reid Cooper
                            last edited by

                            @Reid-Cooper Always.
                            He himself had a folder of old emails which totaled about 20GB. ON THEDESKTOP - Ugh.. Users.

                            1 Reply Last reply Reply Quote 0
                            • gjacobseG
                              gjacobse @Reid Cooper
                              last edited by

                              @Reid-Cooper
                              Uhm.. It's the Manager / Owner wanting to do the clean up.

                              scottalanmillerS 1 Reply Last reply Reply Quote 0
                              • nadnerBN
                                nadnerB
                                last edited by

                                GPO to clean off profiles >2months old?

                                1 Reply Last reply Reply Quote 0
                                • nadnerBN
                                  nadnerB
                                  last edited by

                                  I have a work-in-progress power shell script that looks in specific locations and deletes the contents (some app data folders, desktop, documents, favourites etc) and resets the theme to default Windows theme.

                                  The log file output doesn't work yet.

                                  So it's more of a profile reset/clean up

                                  1 Reply Last reply Reply Quote 0
                                  • scottalanmillerS
                                    scottalanmiller @gjacobse
                                    last edited by

                                    @gjacobse said:

                                    @Reid-Cooper
                                    Uhm.. It's the Manager / Owner wanting to do the clean up.

                                    Put it in writing that if ANYONE sits down at his computer, even on accident, it will mean instant deletion of HIS files by HIS request.

                                    1 Reply Last reply Reply Quote 1
                                    • DashrenderD
                                      Dashrender
                                      last edited by

                                      I'm confused - You're using folder redirection, so the local copy of the data is only there for speed or network connectivity loss. So there should be nearly zero data loss if you delete the profile after the user logs out.

                                      I'm not sure if there is a reg key on Windows Workstation OS, but there definitely is on Server OS for Remote Desktop Services.

                                      This was something I've seen often turned on to keep the local storage needs of the RDS server from ballooning out of control from left over profiles.

                                      User logs into RDS, downloads profile, user logs out - copy is pushed to the server and local directory is deleted.

                                      Pretty standard practice.

                                      I'd be surprised if this wasn't available on say Windows 7, etc.

                                      1 Reply Last reply Reply Quote 1
                                      • 1 / 1
                                      • First post
                                        Last post