Solved

Network Maintenance Plan that does not require user interaction

Posted on 2008-06-11
20
862 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your computer hacked? learn how to detect and delete malware in your PC
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

739 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