Kaseya Community

Anyone using DEFRAGGLER successfully on Windows 2000, XP and Windows 7 and care to share there script?

This question is answered

I am looking for a scrpt that works on both 32bit and 64bit OS.

 

If it works on server 2003/2008 that would be to fantastic as well!

 

Let me know if anyone has something that might meet what it is I am trying to accomplish.

 

If you have a defrag script other than Defraggler, please share your experience with us so we can all possibly use it.

 

Thanks,

Grantb

Verified Answer
  • WIP Nerds.... first one installs defraggler Slim

    <?xml version="1.0" encoding="utf-8"?>

    <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

     <Procedure name="Defraggler Slim Install" treePres="3" id="66614178">

       <Body description="Defraggler Slim Install">

         <If description="Defraggler Slim Install">

           <Condition name="True" />

           <Then>

             <Statement name="GetVariable" continueOnFail="false">

               <Parameter xsi:type="EnumParameter" name="VariableType" value="AgentInstallDrive" />

               <Parameter xsi:type="StringParameter" name="SourceContent" value="" />

               <Parameter xsi:type="StringParameter" name="VariableName" value="agentDrv" />

             </Statement>

             <Statement name="WriteFile" continueOnFail="false">

               <Parameter xsi:type="StringParameter" name="Path" value="#agentDrv#temp\dfsetup121_slim.exe" />

               <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\dfsetup121_slim.exe" />

               <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False" />

             </Statement>

             <Statement name="ExecuteFile" continueOnFail="false">

               <Parameter xsi:type="StringParameter" name="Path" value="#agentDrv#temp\dfsetup121_slim.exe" />

               <Parameter xsi:type="StringParameter" name="Arguments" value="/S" />

               <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

               <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True" />

             </Statement>

           </Then>

         </If>

       </Body>

     </Procedure>

    </ScriptExport>

    This one defrags the C Drive ( I find it runs for awhile)

    <?xml version="1.0" encoding="utf-8"?>

    <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

     <Procedure name="Defraggler C: Drive" treePres="3" id="784251677">

       <Body description="Runs df.exe and defrags the C drive">

         <Statement description="Execute the specified file - full path to file required." name="ExecuteFile" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">

           <Parameter xsi:type="StringParameter" name="Path" value="C:\program files\defraggler\df.exe" />

           <Parameter xsi:type="StringParameter" name="Arguments" value="C: /QD" />

           <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

           <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True" />

         </Statement>

         <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">

           <Parameter xsi:type="StringParameter" name="Comment" value="Defraggler completed Sucessfully" />

         </Statement>

       </Body>

     </Procedure>

    </ScriptExport>

All Replies
  • FYI - If you search the old forums you'll find some conversations on this topic.

  • <?xml version="1.0" encoding="utf-8"?>

    <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

     <Procedure name="DeFraggler" treePres="3">

       <Body description="">

         <If description="">

           <Condition name="True" />

           <Then>

             <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false">

               <Parameter xsi:type="EnumParameter" name="VariableType" value="AgentTempDirectory" />

               <Parameter xsi:type="StringParameter" name="SourceContent" value="" />

               <Parameter xsi:type="StringParameter" name="VariableName" value="TempPath" />

             </Statement>

             <Statement description="Write the selected file to the machine at the path specified - full path required." name="WriteFile" continueOnFail="false" osType="Windows">

               <Parameter xsi:type="StringParameter" name="Path" value="#TempPath#\DF.exe" />

               <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\DeFraggler\df.exe" />

             </Statement>

             <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">

               <Parameter xsi:type="StringParameter" name="Command" value="#TempPath#\df.exe c:" />

               <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

               <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="False" />

             </Statement>

           </Then>

         </If>

       </Body>

     </Procedure>

    </ScriptExport>

  • Thanks for your response David, but I don’t think everyone (including new forum members who are not a part of the old forum) are going to want to go back to a read only forum for more recent k2 related questions.

    Thanks for your Answer Shickey. It seems the silly formatting might have truncated some of the code, are you able to past it into notepad and then attach the notepad doc perhaps to avoid it chaning the code?

    I will give this a shot on some of my test servers. Have you noticed any instances it didn’t work, or things to look out for?

    Thanks,

    Grantb

  • Well, until Brendan brings over the content from the old forum, I still suggest you search there as well (if possible). there were some really good ideas already regarding how to do this, that I'd think you'd like.

    But hey, you can lead a hourse to water...

  • I have a script that will install defraggler slim, and then uses df.exe to defrag the drives... it's not that great, but I will post if you want it.  We still haven't mastered scripting.. but are working towards it.  

  • I am looking for any successful working script that uses agent logs so I can add them to reporting.

    Jrocker,

    Lets see this code you have :)

    I am willing to try things I need something for XP/2003 and Vista/2008

    Thanks, Guys

  • WIP Nerds.... first one installs defraggler Slim

    <?xml version="1.0" encoding="utf-8"?>

    <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

     <Procedure name="Defraggler Slim Install" treePres="3" id="66614178">

       <Body description="Defraggler Slim Install">

         <If description="Defraggler Slim Install">

           <Condition name="True" />

           <Then>

             <Statement name="GetVariable" continueOnFail="false">

               <Parameter xsi:type="EnumParameter" name="VariableType" value="AgentInstallDrive" />

               <Parameter xsi:type="StringParameter" name="SourceContent" value="" />

               <Parameter xsi:type="StringParameter" name="VariableName" value="agentDrv" />

             </Statement>

             <Statement name="WriteFile" continueOnFail="false">

               <Parameter xsi:type="StringParameter" name="Path" value="#agentDrv#temp\dfsetup121_slim.exe" />

               <Parameter xsi:type="StringParameter" name="ManagedFile" value="VSASharedFiles\dfsetup121_slim.exe" />

               <Parameter xsi:type="BooleanParameter" name="DeleteAfter" value="False" />

             </Statement>

             <Statement name="ExecuteFile" continueOnFail="false">

               <Parameter xsi:type="StringParameter" name="Path" value="#agentDrv#temp\dfsetup121_slim.exe" />

               <Parameter xsi:type="StringParameter" name="Arguments" value="/S" />

               <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

               <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True" />

             </Statement>

           </Then>

         </If>

       </Body>

     </Procedure>

    </ScriptExport>

    This one defrags the C Drive ( I find it runs for awhile)

    <?xml version="1.0" encoding="utf-8"?>

    <ScriptExport xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns="www.kaseya.com/.../Scripting">

     <Procedure name="Defraggler C: Drive" treePres="3" id="784251677">

       <Body description="Runs df.exe and defrags the C drive">

         <Statement description="Execute the specified file - full path to file required." name="ExecuteFile" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">

           <Parameter xsi:type="StringParameter" name="Path" value="C:\program files\defraggler\df.exe" />

           <Parameter xsi:type="StringParameter" name="Arguments" value="C: /QD" />

           <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />

           <Parameter xsi:type="BooleanParameter" name="WaitComplete" value="True" />

         </Statement>

         <Statement description="Write an Entry into the Procedure Log" name="WriteScriptLogEntry" continueOnFail="false" osType="NT4|2000|XP|2003|Vista|2008">

           <Parameter xsi:type="StringParameter" name="Comment" value="Defraggler completed Sucessfully" />

         </Statement>

       </Body>

     </Procedure>

    </ScriptExport>

  • Can you attach the script some other way (dont ask me how) but the links are truncated and I am unable to copy/paste.

  • Ok does anyone know how i can zip then attach?

    Thanks

  • Export your script by either right clicking on the button on the toolbar - save the file somewhere handy then find it and right click on it - choose send to Compressed (zipped) Folder.  

    Now hit the option below the box you type your reply in to - Use Rich Formatting then when the screen changes there will be an Options button where you can attach the zip file.

    Apologies if I've misread and have taken this to a very simplistic level, it's the old teacher in me!!!

  • Sorry for the delay on this.  I have had mixed results, some workstations don't need to be defragg'd after running this.  Note it will just do the C Drive.  You need to pull the Slim defraggler which has that df.exe.

    Let me know your results, and i'm sure someone can make it better than me.  I made this in about 2 mins.. thanks.

     

    3617.defraggler.zip

     

  • **correction** I meant to write, some workstations need to be defragged again, and other's don't.  I guess it depends on how bad it needed to be done. :-)

  • Question:  On Windows 7, running the dfsetup121_slim.exe program with the /S switch from command line produces a UAC elevation challenge unless you run CMD.EXE with 'Run as Administrator'.

    When you run this via script, does it use the credentials you set under Agent > Credentials?

  • I was able to get it work on Windows 7 32 bit, but not 64 bit. Still trying

  • You're going to have to add the (x86) to the code