Jump to content

Turn off Vista auto defrag


Valuater
 Share

Recommended Posts

I tried monitor DfrgNtfs.exe with ProcMon while I changed the setting and closed the dialog, it opened a bunch of registry values, but it didn't change the value of anyone important, so I suspect that maybe it saves it to a file or something.

I can upload the entire log if you want? It's pretty massive but it really should be somewhere in there.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Jus' do it like the Pros... :)

#RequireAdmin
global $objService

$objService = objcreate("Schedule.Service")

if isobj($objService) then
    $objService.Connect()
    $rootFolder = $objService.GetFolder("\Microsoft\Windows\Defrag")
    GetTasks($rootFolder)
else
    msgbox("", "Vista Scheduler Automation", "NO SCHEDULER SERVICE OBJECT" & @crlf & @crlf & "YOU'RE PROBABLY NOT ON VISTA / W2K8...")
    exit
endif


func GetTasks($folder)
    $colTasks = $folder.GetTasks(0)
    for $task in $colTasks
        if $task.name = "ScheduledDefrag" Then
            $Disclaimer = MsgBox(36, "Vista Scheduler Automation", "Do you want to delete the defrag-task """ & $task.name & """?")
            if $Disclaimer = 6 then
                $folder.DeleteTask($task.name, 0)
            endif
        endIf
    next
endfunc

...and don't bother 'bout the registry...if the task is gone, no automatic defragmentation will happen ("automatic" being an euphemism in this case, 'coz something that is scheduler-controlled is not automatic in my opinion).

Edited by cherdeg
Link to comment
Share on other sites

Don't scratch your head. :) Just look at my other thread of today and you will see I'm far away to reach your MVP level...but I am probably one of the first 100 ppl in DE to be certified as MCITP: Enterprise Administrator on Server 2008 (after being MCSA Security 2003, MCSA Messaging 2003, Linux Administrator by LPI I+II and VMware Certified Professional (VCP) yet for a while). At least it must be worth something. And if I see the words "Modify schedule" on the button of a Microsoft-dialog, I know where to look...

BTW-1: If somebody wants to write a UDF for task-scheduler...these pages will come handy:

http://www.microsoft.com/technet/scriptcen...sta/tasks1.mspx

http://msdn.microsoft.com/en-us/library/aa383614.aspx

http://msdn.microsoft.com/en-us/library/aa382560(VS.85).aspx

BTW-2: If you start the program disk defragmenter, the task is re-created. Someone should check if this also happens when restarting.

Edited by cherdeg
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...