Page 1 of 1

Help: Possible to make a Defragger?

Posted: Sun Dec 30, 2012 5:33 am
by 3aaBrSbeel
Hey, guys. I'm needing of help on making a defragger without help from anti-viruses. I know that there is a system defragger on all computers but don't know how and also the codes. Can you help me? idoit;

Re: Help: Possible to make a Defragger?

Posted: Sun Dec 30, 2012 10:12 am
by Shim
i dont defrag i was able find this
Code: Select all
  Dim ComputerName As String = ""
        Dim wmi As New ManagementObjectSearcher("Select * from Win32_Volume Where Name = 'C:\\'")


        Dim volumes As ManagementObjectCollection

        volumes = wmi.Get()

        For Each Volume As ManagementObject In volumes
            Volume.InvokeMethod("Defrag", Nothing)
        Next
dont forget to add system.management

this could help you some times http://msdn.microsoft.com/en-us/library ... 85%29.aspx :)

Re: Help: Possible to make a Defragger?

Posted: Sun Dec 30, 2012 11:40 am
by 3aaBrSbeel
Hello, #mshimranpro. Sorry, I couldn't find System.Management.dll. I know it's in Reference in my Projects Properties but I wouldn't add.

Re: Help: Possible to make a Defragger?

Posted: Sun Dec 30, 2012 11:58 am
by smashapps
This might be a possible solution:

"The problem happens because System.Management.dll is not referenced by VB.NET compiler by default. In contrast, C# compiler references to this DLL by default in your csc.rsp file. The simpliest way to resolve the issue is to add the following content in the web.config file of your web application, or if you don't have this file, add one with the content below. -- Andy Cheung Microsoft WMI Test Engineer This posting is provided "As Is" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm"

Source: http://forums.asp.net/t/46697.aspx