Share via

is there a way to run cleanmgr.exe on remote machine using powershell

Anonymous
2022-03-14T09:24:49+00:00

Running CleanMgr.exe in a powershell script or by itself seems to work fine as long as you run it locally with an account that has local admin rights. But while trying to run it remotely via any remote management tool or remote scripting command (Invoke-Command) and it does not run. Would someone please let me know if there is way to get cleanmgr.exe to run remotely without any user interaction. like in,

Windows for home | Windows 10 | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2022-03-14T10:08:00+00:00

    Hi Sumit, thanks much for the response

    the requirement is like we have 30-40 machines on weekly basis (random ones)

    to which we would like to schedule a task that runs powershell script to clean up the spaces for those machines without manual intervention

    bur when i try to invoke-command from my local machine to remote machine

    the cleanmgr still runs from my pc and does not do anything on remote pc

    is there a way that we can clean up space in remote pc's using a script

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2022-03-15T07:58:50+00:00

    Thank you Sumit

    0 comments No comments
  3. Sumit D - IA 167K Reputation points Independent Advisor
    2022-03-14T12:16:06+00:00

    Thanks Shruthi, the only way is to run Storage Sense in that case on the remote computer.

    0 comments No comments
  4. Sumit D - IA 167K Reputation points Independent Advisor
    2022-03-14T09:57:00+00:00

    Hi Shruthi,

    I am Sumit here to assist you with this question.

    Did you try this command?

    C:\WINDOWS\system32\cleanmgr.exe /autoclean /d C:

    If that didn't help, I recommend using Storagesense, which is the successor to Disk Cleanup, which is a deprecated tool.

    http://www.jaapbrasser.com/configure-storage-se...

    How to Turn On or Off Storage Sense to Automatically Free Up Space in Windows 10

    https://www.tenforums.com/tutorials/75317-turn-...

    Hope that helps.

    Standard 3rd party link disclaimer:

    There may be links to non-Microsoft websites that would provide accurate and safe information. Watch out for ads on the websites which are frequently classified as a PUP (Potentially Unwanted Products). There is no need to buy paid products to fix your computers as they do more harm than good sometimes.

    0 comments No comments