Re: Writing Script for ScanDisk and Defrag

Tech-Archive recommends: Fix windows errors by optimizing your registry



Put these lines into c:\Windows\MyDefrag.bat:
@echo off
chkdsk.exe /.. /.. /..
defrag.exe /.. /.. /..

Add your own switches as required. As Jeffery recommended, type
defrag /? and
chkdsk /?
at the Command Prompt to see what the switches mean.

Running these commands frequently may give you a warm feeling
inside but is neither necessary nor recommended. Chkdsk.exe does
not need to be run all the time in a healthy system and defragging
your partition frequently makes no difference to the speed but could
corrupt the file system if the system gets rebooted in the middle, e.g.
because of a power failure.


"JayBee" <JayBee@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6743AA97-3527-4296-986B-9C8762C701A2@xxxxxxxxxxxxxxxx
Can you give me an example of a basic script for them? I am not real sure
how
I would write it to get it to work. Thanks in advance.

"Jeffery Hicks [MVP]" wrote:

open a command prompt and run defrag /? and chkdsk /? to see the syntax
for
each command.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.

"JayBee" <JayBee@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:954818FD-6444-4411-8E96-3584E87D8ABB@xxxxxxxxxxxxxxxx
Do you know of just a basic script I can write in Notepad to run defrag
and
scandisk?

"Jeffery Hicks [MVP]" wrote:

You could make it part of a user's logon script, assuming their
account
has
rights to run defrag. Another option would be to make it part of a
computer
startup-script. Or as a variation, use a computer startup script to
set
the
scheduled task to run one time only. You could then use a computer
shutdown
task to delete the job if you wanted.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.

"JayBee" <JayBee@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2E9F79A2-BCC4-43AF-B5DC-CA179509280C@xxxxxxxxxxxxxxxx
Thanks for the info, but I need a script I can run once and it push
to
all
the computers on our network. We don't want to have to go to every
pc
and
set
up a scheduled task. Any ideas?

"Al Dunbar" wrote:

Running defrag as a scheduled task makes sense; fragementation
occurs
naturally on a healthy volume, so there is really no need to know
what
is
going on with defrag unless it reports a serious disk error. But,
as
far
as
I know, any conditions that CHKDSK might resolve would be better
known
about
than simply "fixed".


/Al

"Jeffery Hicks [MVP]" <jhicks@xxxxxxxxxx> wrote in message
news:ume6yL%23SIHA.4104@xxxxxxxxxxxxxxxxxxxxxxx
If you have XP and later clients you can use DEFRAG.EXE from the
command
line. You can't run it remotely. You might try setting up a
scheduled
task to do it. You can do that remotely using SCHTASKS.EXE. You
could
do
the same thing with CHKDSK.EXE.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.

"JayBee" <JayBee@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:60D55911-5707-4B16-B650-06FE51D6E1DD@xxxxxxxxxxxxxxxx
I need help figuring out a good script to write for running
ScanDisk
and
Defrag on our network. It would need to be able to run on all
the
pc's.
Can
I use it in Group Policy? Any suggestions? Thanks in advance.






.



Relevant Pages

  • Re: Writing Script for ScanDisk and Defrag
    ... Jeffery Hicks ... Microsoft PowerShell MVP ... Coming Soon: Windows PowerShell: TFM 2nd Ed. ... Plus you can do things like boot time defrag ...
    (microsoft.public.scripting.wsh)
  • Re: Writing Script for ScanDisk and Defrag
    ... then create a computer startup script GPO to run it. ... determine if a defrag is needed. ... Microsoft PowerShell MVP ... Coming Soon: Windows PowerShell: TFM 2nd Ed. ...
    (microsoft.public.scripting.wsh)
  • Re: Writing Script for ScanDisk and Defrag
    ... Microsoft PowerShell MVP ... Coming Soon: Windows PowerShell: TFM 2nd Ed. ... Plus you can do things like boot time defrag ...
    (microsoft.public.scripting.wsh)
  • Re: Writing Script for ScanDisk and Defrag
    ... Plus you can do things like boot time defrag ... Jeffery Hicks ... Microsoft PowerShell MVP ... Coming Soon: Windows PowerShell: TFM 2nd Ed. ...
    (microsoft.public.scripting.wsh)
  • Re: Writing Script for ScanDisk and Defrag
    ... you can't do with the built-in defrag tools. ... Jeffery Hicks ... Microsoft PowerShell MVP ... Coming Soon: Windows PowerShell: TFM 2nd Ed. ...
    (microsoft.public.scripting.wsh)