Re: Writing Script for ScanDisk and Defrag



Will I have to put this on each computer seperately or can I implement it in
Group Policy? I am not much for writing script or code. Can you give me the
best example to run it and where to put it? Thanks.

"Jeffery Hicks [MVP]" wrote:

All you need is a small batch file:

@echo off
defrag c:

What I don't know is if if non-admin users can execute this. I suspect not.
If that is the case, then create a computer startup script GPO to run it.
What you could do in addition is add code to only run if the date is say the
first of the month. Or store a value in the registry and check that to
determine if a defrag is needed.


--
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:65328973-E801-4C7F-B5BA-2237A188E185@xxxxxxxxxxxxxxxx
Deskstops only, Windows XP OS, some users have admin rights, some don't,
it
would need to be done once a month, no need for results reporting,
probably
quite a bit a free space on most pc's, only concern is C:\.

No problems has occurred, just want some sort of preventive maintenance
done.

"Jeffery Hicks [MVP]" wrote:

I know you're stuck in a bad position. Managers think scripting can be a
"cheap" solution, but that is not always the case and I suspect in your
situation this is going to be the case. But back to the situation at
hand...

First, are we talking desktops, servers or both? What OS do you have to
support? Do user's have local admin rights? Is this a one time deal or
something you want to do on some sort of repeated basis? Do you need any
sort of centralized results reporting? Do you have an idea of how much
average free space, as a percentage, users or servers have? Do you have
to
worry about drives other than C:\?

Can I ask what is driving this? Is there some suspicion of a problem?
Did
somebody read something in a trade mag that they think everything needs
to
be defragged?

This is not necessarily a difficult task but let's make sure we do it
right

--
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:ACB16357-3B13-4403-BA6F-718C750CF54B@xxxxxxxxxxxxxxxx
I am quite positive I wouldn't get the approval to buy something like
DiskKeeper. The big bosses want a simple script wrote to run this. Is
there
not an easy VB script I can write to get this going? Please Help!!
Thanks.

"Jeffery Hicks [MVP]" wrote:

As much as scripting can help, this may be a situation where a third
party
like DiskKeeper or PerfectDisk may be warranted. You clearly have the
need
to manage multiple machines. Using a third party tool gives you much
more
control and information. Plus you can do things like boot time defrag
which
you can't do with the built-in defrag tools.

If management has identified this task as business critical they
should
recognize the need to get the best solution.

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

"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message
news:#Th4HMWTIHA.4656@xxxxxxxxxxxxxxxxxxxxxxx
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.








.


Loading