Mik3
Mik3

Reputation: 1

Batch File to Wipe Changes

I have been trying to create a batch file to wipe changes made on a computer, put simply: The company I work for hire out laptops, we image most of the laptops upon return to our warehouse. We have just purchased some new high spec laptops which are only being used on special occasions, we would like the ability to run a batch file that basically deletes any files added to the machine/clears the internet history etc.

I have run a few scripts but not found anything that works for all of the above, effectively we want to be able to run a batch file that restores the laptops and settings from a previous date or has the ability to wipe all files added after a certain date.

Can this be done?

We have used a similar file to wipe Laptops of a different spec which I have added below, this doesn't work on the high spec ones mentioned above.

  @echo off
if exist "%USERPROFILE%\Documents" (
    rd /s /q "%USERPROFILE%\Documents"
    md "%USERPROFILE%\Documents"
) else (
    rd /s /q "%USERPROFILE%\My Documents"
    md "%USERPROFILE%\My Documents"
)

if exist "C:\A-R" (
    rd /s /q "C:\A-R"
    md "C:\A-R"
) else (
    rd /s /q "C:\A-R"
    md "C:\A-R"
)

if exist "C:\A-S" (
    rd /s /q "C:\A-S"
    md "C:\A-S"
) else (
    rd /s /q "C:\A-S"
    md "C:\A-S"
)

echo Deleting Temporary Internet Files
del /q /f /s "%USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files\*.*"
echo deleted!

echo Deleting Downloads Folder Files
del /q /f /s "%USERPROFILE%\Downloads\*.*"
echo deleted!

echo Deleting History
del /q /f /s "%USERPROFILE%\AppData\Local\Microsoft\Windows\History\*.*"

echo Deleting Flash Player Temp Files
del /q /f /s "%USERPROFILE%\AppData\Roaming\Macromedia\Flash Player\*.*"
echo deleted!

echo Deleting Profile Temp Files
del /q /f /s "%USERPROFILE%\AppData\Local\Temp\*.*"
echo deleted!

echo Deleting User Office Recent Files
del /q /f /s "%USERPROFILE%\AppData\Roaming\Microsoft\Office\Recent\*.*"
echo deleted!

echo Deleting User Office TMP Files
del /q /f /s "%USERPROFILE%\AppData\Roaming\Microsoft\Office\*.tmp"
echo deleted!

start C:\EmptyRB.exe param1/F /Q


start C:\EmptyRB.exe param1/F /Q

shutdown.exe -s -t 00

exit

Thanks

Upvotes: 0

Views: 134

Answers (1)

Serenity
Serenity

Reputation: 31

If they are not administrators they cannot change system settings. Therefore just delete their user account. Done.

A batchfile to do this

net user <username> /delete

you'll have to delete their profile folder (the GUI will do this for you) if using the command line, (although you can wait a few months and do them in batches)

rd "c:\users\<username>" /s /q

to recreate a new user

net user <username> <password> /add

the folder gets created at first logon.

Upvotes: 1

Related Questions