The Infinite Loop – Beginner's SEO, Beginner C# & JQuery Tutorials Problem. Problem Solved. Loop. – The life of a programmer

14May/090

USB Backup Utility with Batches

After my USB got FRIED behind the damn photocopier in the library a couple years ago, I had to re-do my whole Java Assignment AGAIN. I decided to make a little backup utility that would make it a little easier to back up my usb. It will only work if the pen drive is a fixed letter, but its always E: on my computer so thats fine by me. It consists on 2 files placed on the usb, a backup.bat that does the backing up and an autorun.inf which puts the Backup option into the autorun screen. When i plug my USB pen drive, the autorun gives me the option to backup, making an exact copy of my usb at c:/usb

Open notepad and paste this text in.

@echo off
echo USB BACKUP UTILITY V1.0
echo CREATED BY SCOTT
echo ----------------------------------------------------------
echo Starting Backup:
cd \
c:

if exist c:\usb goto exists
mkdir "USB"
goto copy

:exists
rmdir "USB" /s /q
mkdir "USB"

:copy
echo Date>C:\usb\backup.txt
date /t>>C:\usb\backup.txt
echo.>>C:\usb\backup.txt
echo Time>>C:\usb\backup.txt
time /t>>C:\usb\backup.txt
echo ------------------------------------------->>C:\usb\backup.txt

cd \
xcopy E:\* "C:\USB" /y /e /r /v>>C:\usb\backup.txt
echo Backup Complete!
echo.
echo Backup of entire USB at C:/USB
echo Log file placed at C:/USB/backup.txt
echo ----------------------------------------------------------
Pause

In the line xcopy E:\* "C:\USB" /y /e /r /v>>C:\usb\backup.txt, replace E: in this line with your actual drive letter.
Save this file as backup.bat making sure that "All Files" is selected from the files drop down box.


Next repeat the same steps, saving this text as autorun.inf

[autorun]
action=Backup
open=backup.bat
label=MyUsbName
includeRuntimeComponents=True

Save both these files on the root of your USB.
The next time you plug your usb in, you will see the autorun option "backup".
By clicking this and hitting ok, a full usb backup will be performed and put in C:/USB

14May/090

Servernet.exe Removal Utility: How to clean and remove servernet.exe

The ServerNet removal Utility was something I wrote in my 2nd year of College. It was 2 batch files to get rid of an annoying "virus". It would copy itself onto root drives and various locations including 'Program Files\Common Files\MicrosoftShared\MSInfo'. It also creates a service for itself and as mspaint, dllhost, mqsvc and msdtc were all acting strangely in terms of computer usage I ended them before attempting to delete ServerNet. The original for this utility went through many other drives (e: f: z:) removing ServerNet off each. The Servernet.exe file can be found on many drives, as it copies.

For Removal:

AUTOMATIC SERVERNET REMOVAL/CLEANING: Download servernet-removal-tool

MANUAL SERVERNET REMOVAL/CLEANING:

Open notepad and copy paste this text:

sc.exe config Distributed start= disabled
sc.exe delete Distributed
taskkill /F /T /IM mspaint.exe
taskkill /F /T /IM dllhost.exe
taskkill /F /T /IM mqsvc.exe
taskkill /F /T /IM msdtc.exe
xcopy /y "ServerNetRemovalToolStep2.bat"
"C:\Documents and Settings\%userName%\Start Menu\Programs\Startup"
@echo COMPUTER WILL NOW RESTART...
shutdown -r -t 10 -c "Restarting to fully clean virus. Be Patient. Scott =)"

Click File>Save as. In the drop-down menu for files, change it to All Files.
Save this exactly as: ServerNetRemovalStep1.bat

Next repeat with this text and save this file exactly as: ServerNetRemovalStep2.bat

@echo on
taskkill /F /T /IM mspaint.exe
taskkill /F /T /IM dllhost.exe
taskkill /F /T /IM mqsvc.exe
taskkill /F /T /IM msdtc.exe
cd \
h:
attrib -h -s -r autorun.inf
attrib -h -s -r ServerNet.exe
del autorun.inf
del ServerNet.exe
c:
attrib -h -s -r autorun.inf
attrib -h -s -r ServerNet.exe
del autorun.inf
del ServerNet.exe
cd c:\windows\system32
attrib -s -h -r "_ServerNet.exe"
attrib -h -s -r autorun.inf
attrib -h -s -r ServerNet.exe
del autorun.inf
del ServerNet.exe
del _ServerNet.exe
cd ..
cd ..
cd Program Files\Common Files\Microsoft Shared\MSInfo
attrib -h -s -r ServerNet.exe
del ServerNet.exe
cd \
c:
cd Documents and Settings\%userName%\Start Menu\Programs\Startup
del ServerNetRemovalToolStep2.bat
@echo Hopefully your clean now :)
pause

Make sure these 2 files are in the same location, and make sure all your drives are targeted. In the above example, h: and c: are targeted. Just copy paste all the code from the drive letter to the next if you need to clean more than 2 drives. Double click ServerNetRemoval1.bat. You will see a black window, it will do some cleanup, and then will restart your computer. When your computer reboots, it will run a new file which will hopefully get rid of that annoying servernet!