Skip to content

Instantly share code, notes, and snippets.

@malbert911
Created August 23, 2020 00:19
Show Gist options
  • Save malbert911/4afdccb8669eefd8909f905e27cb2589 to your computer and use it in GitHub Desktop.
Save malbert911/4afdccb8669eefd8909f905e27cb2589 to your computer and use it in GitHub Desktop.
Remote Windows Workstation cleanup v1.1
@echo off
cls
echo Remote Windows Workstation cleanup v1.1
echo (c)Matthew Albert
set /p canis="Enter the hostname (example: C732534 or internal-server-1): "
set /p user="Enter the user name of the main user (example: MALBERT): "
echo ===================================================
echo This script will:
echo Connect to: %canis%
echo delete C:\Windows\temp"
echo delete C:\Users\%user%\AppData\Local\Temp"
echo and reboot.
echo Are you Sure You Want To Proceed? (Close this window to cancel)
PAUSE
winrs -r:%canis% del /S /F /Q C:\Windows\temp
winrs -r:%canis% del /S /F /Q C:\Users\%user%\AppData\Local\Temp
winrs -r:%canis% shutdown /r /f
PAUSE
@malbert911
Copy link
Author

Only works well if you have domain level admin from the account you are running this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment