Solved

Network Maintenance Plan that does not require user interaction

Posted on 2008-06-11
20
855 Views
Last Modified: 2012-05-05
Hello,
I am an automation tech for a network of about 800 computers.  They are all Windows XP Pro machines on a domain powered by Windows Server 2003.  I need a Maintenance Plan to upkeep these machines that does NOT require ANY user interaction.  

I don't want the users having any responsibility anymore then I want to go to each machine and run the maintenance individually for each one.

Thanks for your ideas and feedback,

zbox
0
Comment
Question by:zbox
  • 8
  • 7
  • 5
20 Comments
 
LVL 22

Expert Comment

by:Paka
ID: 21762763
No need to visit each machine.  Setup a group policy to perform the maintenance.
0
 
LVL 12

Expert Comment

by:sarangk_14
ID: 21765812
What do you mean by maintenance? If you are talking about running disk check and de-fragmenting drives, you can do that through scheduling. If you are talking about performing registry cleaning, cache cleaning and other such services, there are a number of freeware tools available on the Internet.

Hope this helps.
0
 

Author Comment

by:zbox
ID: 21768349
GPO is a great way to do it.  However, how would you avoid ANY user interaction?  

From what I understand, GPO or scheduling things like Disk Cleanup or Defrag, will prompt on the screen for the user to hit "next" or "analyze."  

Yes by maintenance I do mean Disk Cleanup and Defrag.  Thanks for your comments.

zbox
0
 
LVL 12

Expert Comment

by:sarangk_14
ID: 21768629
Hi,

Please check out the following:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/2000/Q_21036205.html
http://support.microsoft.com/kb/179306

Both these documents tell you about automating the defrag and scandisk, without user intervention.

Hope this helps.
0
 
LVL 12

Expert Comment

by:sarangk_14
ID: 21768677
Hi,

Please check out the following:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/2000/Q_21036205.html
http://support.microsoft.com/kb/179306

Both these documents tell you about automating the defrag and scandisk, without user intervention.

Hope this helps.
0
 
LVL 12

Expert Comment

by:sarangk_14
ID: 21768711
Hi,

Please check out the following:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/2000/Q_21036205.html
http://support.microsoft.com/kb/179306

Both these documents tell you about automating the defrag and scandisk, without user intervention.

Hope this helps.
0
 
LVL 22

Expert Comment

by:Paka
ID: 21769033
Are all of your client machines configured the same - specifically do they have the same type of disk configuration?  If you can identify how many volumes they have and the letters, I'll put a batch file that you can deploy using group policy.
0
 

Author Comment

by:zbox
ID: 21769043
this like exactly what im talking about!  can't wait to try it out.  I'll be in touch, thanks experts for your comments, thanks sarangk.  I'll be back to this question ASAP after I see the results.

zbox
0
 
LVL 22

Expert Comment

by:Paka
ID: 21769502
Here are a couple more questions I need answered before I can put the script together.
Is it OK to reboot the machines at 0100?
Is it OK to run the scandisk at 0100 each sunday?
Is it OK to run the defag at 0200 each sunday?
0
 

Author Comment

by:zbox
ID: 21770769
yes to all of the above.

The computers have the same disk config and only the C: drive.

also 0100 hours is fine and sunday is fine too.  but if possible, make a note that i can edit the script if i need to change the time on my own if that changes.

woot!  keep in touch
0
Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

 
LVL 12

Expert Comment

by:sarangk_14
ID: 21770968
0
 
LVL 22

Expert Comment

by:Paka
ID: 21771081
There's going to be a lot of "moving parts" on this one.  Give me about an hour to put the group policy steps and script together.
0
 
LVL 22

Expert Comment

by:Paka
ID: 21772068
Here goes:
Save the code snippet below to a file named "chkNDefrag.bat"

Logon to a machine using an admin account.
Open a command prompt and type \\domainname\netlogon to open the netlogon directory for your domain.  Copy the chkNDefrag.bat file to the netlogon share.

Open Active Directory Users and Computers
Right click on your domain name and select properties
Click Group Policy tab
Click New
Name your new group policy "Chkdsk and Defrag"
Open Computer Configuration, Windows Settings, Scripts
Double-click Startup in right-hand pane
Click Add
Click Browse
Type \\domainname\netlogon in File name box
Click Open
Double-click chkNDefrag.bat
Click OK
Close Group Policy Editor
Click OK to close Group Policy

Restart a machine in your domain.
Open a command prompt
Type "tasks" and enter to view scheduled tasks
Verify three tasks named "Chkdsk Task", "Restart Task" and "Defrag Task" are scheduled for 12:45, 01:00 and 02:00

Since you have a good sized domain, you might want to test this change on a couple machines to ensure there are no issues.  To do so, create a test OU - let's call it testOU and create and assign the group policy against that OU instead of the domain.  You will also need move a couple test machines into that OU.

'Program: CheckAndDefrag.bat

'Author: Pat Lee

'Date: 6/12/2008
 

'Clear all scheduled tasks defined by this script

schtasks /delete /tn "DirtyBit Task" /f

schtasks /delete /tn "Restart Task" /f

schtasks /delete /tn "Defrag Task" /f
 

'Set scheduled tasks to set chkdsk, restart and defrag

schtasks /create /ru "SYSTEM" /sc WEEKLY /d SUN /TN "DirtyBit Task" /tr "c:\windows\system32\fsutil.exe dirty set c:" /st 00:45:00 /sd "01/01/2008"

schtasks /create /ru "SYSTEM" /sc WEEKLY /d SUN /TN "Restart Task" /tr "c:\windows\system32\shutdown.exe -r -t 60" /st 01:00:00 /sd "01/01/2008"

schtasks /create /ru "SYSTEM" /sc WEEKLY /d SUN /TN "Defrag Task" /tr "c:\windows\system32\defrag.exe c:" /st 02:00:00 /sd "01/01/2008"

Open in new window

0
 

Author Comment

by:zbox
ID: 21773205
Paka thanks a lot for your time and hard work.  I really appreciate what you guys do on this site, thats why im already telling people about it!

But I have to be honest.  My job just gave me until tomorrow morning to present this idea.  For reasons I don't want to go into, I don't have access to Win Server2003 right now.  As much as I would like to try your idea Paka, I thought I had more time.  

But if you can help me with this, I found this script that I've already familiarized myself with and actually got to work.  I just need one thing, I need this script to include running Disk Cleanup.  It does CHKDSK then it does DEFRAG, but if you can get it to run disk cleanup and I test it at home and make a powerpoint by tomorrow of something that works, I might have to buy you all dinner. lol

anyways, Paka, again I don't want to ignore your code I know you spent time to write, but I dont have time to test that anymore.  =/

Here is the code that I'm using, (found it through EE KB), and I just need it to include an Automated Disk Cleanup step, perferably before defrag.


*************************************************************************************
REM chkdsk and defrag automation
for /F "eol= tokens=1 delims=( " %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk
 
:dsKchk
If %DrvLtr% == end goto :eof
chkdsk %DrvLtr%
If not errorlevel 3 goto :defrag
If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon
 
:dskchkoff
cd\
%DrvLtr%
echo Y chkdsk /F /R
goto :defrag
 
:dskchkon
chkdsk %DrvLtr% /F /R
 
:defrag
cd\
%DrvLtr%
defrag %DrvLtr% -b
defrag %DrvLtr%
:EOF
********************************************************************************
0
 
LVL 22

Expert Comment

by:Paka
ID: 21773338
What do you want Disk Cleanup to clean?  You have these options:

Temporary Internet Files
Temporary Setup Files
Downloaded Program Files
Old Chkdsk Files
Recycle Bin
Temporary Files
Temporary Offline Files
Offline Files
Compress Old Files
Catalog Files for the Content Indexer

Getting this one to run is a bit more complicated but do-able.  It might take a dinner and a beer from Bennigan's to coax this one out of me ;)
0
 

Author Comment

by:zbox
ID: 21773416
cleaning all of that is fine.

Is there one missing though?  "Outlook Setup Files"

I DO NOT want "Outlook Setup Files" to be deleted.  that can stay right where it is.  (you probally predicted that and left it out on purpose.)

So yes all of these are fine and im just repeating your list:

Temporary Internet Files
Temporary Setup Files
Downloaded Program Files
Old Chkdsk Files
Recycle Bin
Temporary Files
Temporary Offline Files
Offline Files
Compress Old Files
Catalog Files for the Content Indexer

Paka, Bennigan's it is!  lol

Thanks for fast responses.  I'll check back ASAP.

zbox
0
 
LVL 22

Accepted Solution

by:
Paka earned 500 total points
ID: 21773662
I'm going to have to call it a night.  The wife said enough Expert's Exchange.  Here's the link to get the last part to get your script going:
http://www.ss64.com/nt/cleanmgr.html

After you create the registry settings for what you want cleaned and exported them to a file named "cleanmgr.reg" use the attached script:
*************************************************************************************

REM chkdsk and defrag automation

for /F "eol= tokens=1 delims=( " %%i in (DrvLtr.txt) do set DrvLtr=%%i& call :dsKchk

 

:dsKchk

If %DrvLtr% == end goto :eof

chkdsk %DrvLtr%

If not errorlevel 3 goto :defrag

If not exist %DrvLtr%\winnt If not exist %DrvLtr%\windows If not exist %DrvLtr%\pagefile.sys goto :dskchkon

 

:dskchkoff

cd\

%DrvLtr%

echo Y chkdsk /F /R

goto :defrag

 

:dskchkon

chkdsk %DrvLtr% /F /R

 

:defrag

cd\

%DrvLtr%

defrag %DrvLtr% -b

defrag %DrvLtr%
 

:dskClean

REGEDIT /S cleanmgr.reg 

CLEANMGR /sagerun:64
 

:EOF

********************************************************************************

Open in new window

0
 

Author Comment

by:zbox
ID: 21775739
I think I'm confused and very tired at that.  I'll do my best to put the pieces together.
0
 

Author Closing Comment

by:zbox
ID: 31466254
WOOOO!  Paka, you really stuck in there.  I don't know what they pay you guys but its not enough I'm sure.  Thanks again Paka and EE!

satisfied customer,

zbox
0
 
LVL 22

Expert Comment

by:Paka
ID: 21779271
To get your cleanmgr to work without user input, you will have to create a registry import file (for instance cleanmgr.reg).  To setup the registry import file, open a command prompt and type:
cleanmgr /sageset:64 (64 could be any number 0-65000).  After you run it and select the items you want cleaned and exit.  (For our example we will clean Recycle Bin - so only check Recycle Bin.)   Now open regedit and open:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin

You should see a key named "StateFlags0064" with a value of 2.  This means you want that particular item cleaned; all of the other items should have a "StateFlag0064" set to 0.  You will need to export all of these items (or use the cleanmgr.reg file from the link above) and set each item you want cleaned to 2 and those items you don't want cleaned to 0.  Save this file as "cleanmgr.reg".  Next type "regedit /s cleanmgr.reg" from a command prompt to load this set of "StateFlags0064" into the local registry.

Last, run cleanmgr /sagerun:64 to run cleanmgr with the items you selected using the process above.

You should be able to figure out the batch file above after that...

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now