Laptop Cleanup RRS feed

  • Question

  • So, my goal for the day was to create a little batch file which would do all of the basic cleanup for our loaner laptops for a quicker turn-around when we get them back in the IT department.

    Most of it is working (deleting documents, desktop, etc; resetting desktop links, scanning for viruses, etc), but of all things, I am having difficulty with Disk Cleanup.  My code is essentially:

    import reg DiskCleanupSettings.reg
    cleanmgr /sagerun:1

    On another device I ran cleanmgr /sageset:1 and made my selections, then exported the registry settings.  This then imports those settings to the laptop, and runs them.

    The issue I am running into is that when I run the script as administrator (which is needed for other parts of the script) it will scan for the file cleanup, but then do nothing.  If I just run the bat as a normal user, most of the rest of the script fails, but this part will scan and clean up the files as expected.

    Question is 2-fold:
    1)Why is this behaving this way?  I would love to understand it.

    2) Other than creating a 2nd script to run as a normal user, is there a way to run one command with different rights so it runs correctly?

    • Moved by Bill_Stewart Wednesday, September 5, 2018 10:02 PM Unanswerable drive-by question
    Tuesday, July 3, 2018 7:27 PM

All replies

  • ]

    You issues are not scripting issues.  They are specific to a system utility.  Post in the Windows General forum for assistance.


    Tuesday, July 3, 2018 8:14 PM