Jump to content

Re the request for a workstation clean up script...


Recommended Posts

Posted

This will need a bit of editing...

 

@echo off

:*****************************************************************

:*

:* This script is designed to tidy up WinXP and Win2k client machines

:*

:* Ver: 1.2

:* Date: 01/04/04

:*

:*****************************************************************

 

:*****************************************************************

:Set the time of the computer to that of the domain controller

:*****************************************************************

echo Setting the time

net time /domain:boys /set /y

 

 

:*****************************************************************

:flowol fix

:*****************************************************************

 

rem \\boys.jktc.uk\home\Software\Flowol2\Install_Mimic_Creator\Setup.exe

rem \\boys.jktc.uk\home\Software\Flowol2\Install_Mimic_Creator\SetupEx.exe

xcopy /c/r/y \\ict_srv1\netlogon\flowol2_Default.ini %windir%\flowol2.ini

 

:*****************************************************************

:merge in useful registry entries

:*****************************************************************

echo adding registry entries

regedit.exe /s "\\ict_srv1\NETLOGON\Standard_Student.reg"

:pause

 

:*****************************************************************

:copy JKBTC Wallpapers

:*****************************************************************

c:

cd c:\

if exist c:\wallpapers goto SkipWall

 

echo copying Wallpapers

xcopy "\\ict_srv1\NETLOGON\Wallpapers" "C:\Wallpapers\" /h /r /c /y

:pause

 

:SkipWall

 

:*****************************************************************

: install qca exams

:*****************************************************************

rem "\\boys.jktc.uk\Software\QCATest2005\KS3ICT-2005-P-ABC 2215\KS3ICT-2005-P-ABC 2215.msi" /q

rem "\\boys.jktc.uk\Software\QCATest2005\KS3ICT-2005-P-FMA 3084\KS3ICT-2005-P-FMA 3084.msi" /q

rem "\\boys.jktc.uk\Software\QCATest2005\KS3ICT-2005-P-FMB 3084\KS3ICT-2005-P-FMB 3084.msi" /q

rem "\\boys.jktc.uk\Software\QCATest2005\KS3ICT-2005-S-PRE 1430\KS3ICT-2005-S-PRE 1430.msi" /q

 

:*****************************************************************

:copy special version of MS Paint

:*****************************************************************

rem c:

rem cd c:\

rem echo copying MS Paint (Special Version)

rem xcopy "\\ict_svr\1111 config files\hex edits for apps\mspaint.exe" %windir%\system32\dllcache\mspaint.exe /h /r /c /y

rem xcopy "\\ict_svr\1111 config files\hex edits for apps\mspaint.exe" %windir%\system32\mspaint.exe /h /r /c /y

:pause

 

:*****************************************************************

: Move to location for "profiles" and remove old profiles

:*****************************************************************

echo "Removing profiles"

 

cd "c:\Documents and Settings"

 

if exist DeleteFolders.log del /Q DeleteFolders.log

 

: Hide foldes we want to keep

attrib +H Admin*

attrib +H "Default User"

attrib +H "Default User (Network)"

attrib +H "All Users"

attrib +H sweepupd

attrib +H Clean*.

 

:pause

 

: Get list of visible folders. These are the ones we delete

dir /b >> DeleteFolders.log

 

FOR /F "tokens=*" %%A in (DeleteFolders.log) do rmdir /S /Q "%%A"

 

if exist DeleteFolders.log del /Q DeleteFolders.log

 

:pause

 

:Unhide the folders

 

attrib -H Admin*

:attrib -H "Default User"

:attrib -H "Default User (Network)"

attrib -H "All Users"

attrib -H sweepupd

attrib -H Clean*.

 

:pause

 

:*****************************************************************

:Delete some temporary files (Windows and Internet Explorer)

:*****************************************************************

echo Delete temporary files

del /q /s "c:\Documents and Settings\Admin\local settings\Temporary internet files\*.*"

del /q /s "c:\Documents and Settings\Admin\local settings\Temp\*.*"

del /q /s "c:\Documents and Settings\Administrator\local settings\Temporary internet files\*.*"

del /q /s "c:\Documents and Settings\Administrator\local settings\Temp\*.*"

 

:pause

 

:*****************************************************************

: Hide various important folders and files in top level of C:

:*****************************************************************

echo tidy up c:\

cd C:\

 

attrib +H "Documents and Settings"

attrib +H "Program Files"

attrib +H "RECYCLER"

attrib +H "System Volume Information"

attrib +H "%windir%"

attrib +H "arcldr.exe"

attrib +H "arcsetup.exe"

attrib +H "AUTOEXEC.bat"

attrib +H "boot.ini"

attrib +H "CONFIG.SYS"

attrib +H "IO.SYS"

attrib +H "MSDOS.SYS"

attrib +H "ntldr*"

attrib +H "pagefile.sys"

 

:pause

 

:*****************************************************************

: Tidy up the contents of the top level of the C:

:*****************************************************************

cd c:\

 

del c:\*.jif

del c:\*.txt

del c:\*.tmp

del c:\*.doc

del c:\*.xls

del c:\*.pub

del c:\*.bmp

del c:\*.jpg

del c:\*.zip

del c:\*.gbc

del c:\*.wma

del c:\*.wav

del c:\*.mp3

del c:\*.mpeg

del c:\*.mpga

del c:\*.avi

del c:\*.wa_

del c:\*.rm_

del c:\*.pdf

del c:\*.htm

del c:\*.html

del c:\*.theme

del c:\newfol~1\*.* /Q /S

rd c:\newfol~1 /Q /S

del c:\~

 

:pause

 

:*****************************************************************

: Tidy up the Temp directory

:*****************************************************************

echo Tidy up Temp dir etc

del c:\temp\*.* /Q /S

rd c:\temp\ /Q /S

md c:\Temp

 

del %windir%\temp\*.* /Q /S

rd %windir%\temp\ /Q /S

md %windir%\Temp

 

:*****************************************************************

: Tidy up "Program Files"

:*****************************************************************

del c:\progra~1\*.pub

del c:\progra~1\*.doc

del c:\progra~1\*.xls

 

:*****************************************************************

: Tidy up "Windows directory"

:*****************************************************************

cd %windir%

del %windir%\*.txt

del %windir%\*.tmp

del %windir%\*.doc

del %windir%\*.xls

del %windir%\*.pub

del %windir%\*.cdr

del %windir%\*.acl

del %windir%\*.pcb

del %windir%\*.asd

del %windir%\*.jpg

del %windir%\*.gif

del %windir%\*.cct

del %windir%\*.dmp

del %windir%\*.wma

del %windir%\*.zip

del %windir%\*.gbc

del %windir%\*.mp3

del %windir%\*.mpeg

del %windir%\*.mpga

del %windir%\*.avi

del %windir%\*.wa_

del %windir%\*.rm_

del %windir%\*.pdf

del %windir%\~

 

:pause

 

:*****************************************************************

: logoff from the machine

:*****************************************************************

if NOT exist %windir%\system32\down.exe xcopy \\ict_srv1\NETLOGON\down.exe %windir%\system32\ /h /r /c /y

:pause

%windir%\system32\down hostname /R /Q 20 "Rebooting this machine"

Posted

My pleasure John. I can't take full credit for it though! I started it as an NT script that could be called locally or from the logon. It did a good job under good old NT. Since then, and moving on to 2k and XP, myself and various colleagues have added and enhanced it. My present co worker has a good programing background. Time permiting, I'll see if we've got any others that can be put in the scripts forum. I'm new to this board, and I look forward to having the time to explore it fully.

 

down.exe is a little nt/2k-ish util to shut down/reboot a pc- might not be ok for xp?

(http://www.losoft.de/)

The version of paint.exe is one that was bent using a 'hex editor' (?) to remove the 'save this image as wallpaper' grief.

 

Here's a very early version of script, just for fun...

 

cd c:\winnt\profiles

 

del DeleteFolders.log

 

attrib +H Admin

attrib +H Administrator

attrib +H "Default User"

attrib +H "Default User (Network)"

attrib +H "All Users"

attrib +H sweepupd

attrib +H "Clean"

 

dir /b >> DeleteFolders.log

 

FOR /F "tokens=*" %%A in (DeleteFolders.log) do rmdir /S /Q "%%A"

 

if exist DeleteFolders.log del /Q DeleteFolders.log

 

attrib -H Admin

attrib -H Administrator

attrib -H "Default User"

attrib -H "All Users"

attrib -H sweepupd

attrib -H "Default User (Network)"

 

cd c:\winnt\profiles\admin\local settings\Temporary internet files\*.*

 

cd\

 

net time /domain:jkb_masternet /set /y

del c:\*.jif

del c:\*.txt

del c:\*.tmp

del c:\*.doc

del c:\*.xls

del c:\*.pub

del c:\*.bmp

del c:\*.jpg

del c:\*.zip

del c:\*.gbc

del c:\*.wma

del c:\*.wav

del c:\*.mp3

del c:\*.mpeg

del c:\*.mpga

del c:\*.avi

del c:\*.wa_

del c:\*.rm_

del c:\*.pdf

del c:\*.htm

del c:\*.html

del c:\newfol~1\*.* /Q /S

rd c:\newfol~1 /Q /S

del c:\~

 

del c:\temp\*.* /Q /S

rd c:\temp\ /Q /S

md c:\Temp

 

del c:\progra~1\*.pub

del c:\progra~1\*.doc

del c:\progra~1\*.xls

 

del c:\winnt\*.txt

del c:\winnt\*.tmp

del c:\winnt\*.doc

del c:\winnt\*.xls

del c:\winnt\*.pub

del c:\winnt\*.cdr

del c:\winnt\*.acl

del c:\winnt\*.pcb

del c:\winnt\*.asd

del c:\winnt\*.jpg

del c:\winnt\*.gif

del c:\winnt\*.cct

del c:\winnt\*.dmp

del c:\winnt\*.wma

del c:\winnt\*.zip

del c:\winnt\*.gbc

del c:\winnt\*.mp3

del c:\winnt\*.mpeg

del c:\winnt\*.mpga

del c:\winnt\*.avi

del c:\winnt\*.wa_

del c:\winnt\*.rm_

del c:\winnt\*.pdf

del c:\*.jif

del c:\winnt\~

 

del c:\winnt\Personal\*.* /Q /S

del c:\winnt\Personal\~ /Q /S

rd c:\winnt\Personal\ /Q /S

md c:\winnt\Personal

 

 

del c:\winnt\cookies\index.dat

del c:\winnt\cookies\*.txt

 

 

DEL c:\winnt\tempor~1\*.* /Q /S

rd c:\winnt\tempor~1\ /Q /S

md "c:\winnt\Temporary Internet Files"

 

: choice/c:./t.,10/n

 

c:\winnt\system32\down hostname /l /Q

Posted

Down can also be called using a text file containing pc names and a for loop in a batch script to shut down whole rooms this could also be scheduled.

 

Ben

Posted

Thanks Ben. I remember the first time I used it with a text file to shut down a room, and the feeling of satisfaction. Pity it didn't shut the room down permanently...

But does it work with XP ? (no time to test).

I've got some WOL shutdown progs somewhere, again, it's just no time to develop.

Posted
if down.exe is a shutdown tool, it isn't needed in XP. XP has it's own shutdown tool called shutdown.exe. Its located in the %systemroot%\system32 directory.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...