Windows 7

Checking Free Disk Space on the System Drive

Hard disks with capacities measured in the hundreds of gigabytes are commonplace even in low-end systems nowadays, so disk space is much less of a problem than it used to be. However, remember that Windows Home Server has a system partition-drive C:-and that volume comes with a fixed 60GB size. With Windows Home Server taking up about 10- to 16GB (depending on the size of the paging file), you only have so much space left over to install other programs or store data in the Administrator account's local folders. Therefore, it's a good idea to keep track of how much free space you have on drive C:.

One way to check disk free space is to select Start, Computer. The Tiles view (select View, Tiles to see it) tells you the free space and the total size and displays the used portion of the disk in a graph. Alternatively, right-click drive C: in Windows Explorer and then click Properties. The system partition's total capacity, as well as its current used and free space, appear in the General tab of the property sheet.

In Windows Explorer, display the Computer window in Details view to see the total size and free space on your system's disks.
Right-click drive C:, and then click Properties to see the system drive's total size and free space.

Listing below presents a VBScript procedure that displays the status and free space for each drive on your system.

LISTING below: A VBScript Example That Displays the Status and Free Space for the System Drive (C:)

Option Explicit
    Dim objFSO, strMessage

    ' Create the File System Object
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    ' Start the display string
    strMessage = "Status Report for Drive C" & vbCrLf & vbCrLf

    ' Get the properties of drive C
    With objFSO.Drives("C")

	' Add the volume name to the message
	strMessage = strMessage & "Volume Name: " & .VolumeName & vbCrLf

	' Check the drive status
	If .IsReady = True Then

	    ' If it's ready, add the status, total size,
	    ' and the free space to the message
	    strMessage = strMessage & "Status: Ready" & vbCrLf
	    strMessage = strMessage & "Total space: " & _
			FormatNumber(.TotalSize / 1073741824, 2) & " GB" & vbCrLf
	    strMessage = strMessage & "Free space: " & _
			FormatNumber(.FreeSpace / 1073741824, 2) & " GB"
	    strMessage = strMessage & vbCrLf & vbCrLf
	Else

	    ' Otherwise, just add the status to the message
	    strMessage = strMessage & "Status: Not Ready" & vbCrLf & vbCrLf
	End If
    End With

    ' Display the message
WScript.Echo strMessage

This script creates a FileSystemObject and then uses its Drives collection to return a reference to the system drive: Drives("C"). Then the script checks the Drive object's IsReady property. If the drive is available (there's no reason why it wouldn't be, but you never know), a series of property values is added to the message: VolumeName, TotalSize, and FreeSpace. (Note that the last two are converted from bytes to gigabytes by dividing the property value by 1,073,741,824.) The script finishes by displaying the drive data.

Deleting Unnecessary Files from the System Drive

In the previous section, mentioned that with hard drive capacities now regularly weighing in at several hundred gigabytes (with terabyte-1,000 gigabytes-and larger drives now readily available), free hard disk is not the problem it once was. Or is it? Just as these massive hard drives became affordable, it also became commonplace to create huge, multigigabyte files from DVD rips and recorded TV shows. In other words, no matter how humongous our hard drives are, we always seem to find a way to fill them up.

On your Windows Home Server system, you probably store any large data files in the shared folders, where your storage space should be large enough to handle them. However, that doesn't mean your system drive (C:) is in no danger of filling up. You only get 60GB to play with, and if you install large programs such as SharePoint Foundation and programming tools such as Visual Studio Express, you may find that it doesn't take you all that long to fill up the system drive.

If you find that the system partition is getting low on free space, you should delete any unneeded files and programs. Windows Home Server comes with a Disk Cleanup utility that enables you to remove certain types of files quickly and easily. Before discussing this utility, let's look at a few methods you can use to perform a spring cleaning on your hard disk by hand:

  • Uninstall programs you don't use- If you have an Internet connection, you know it's easier than ever to download new software for a trial run. Unfortunately, that also means it's easier than ever to have unused programs cluttering your hard disk. Use the Control Panel's Add or Remove Programs icon to uninstall these and other rejected applications.
  • Delete downloaded program archives- Speaking of program downloads, your hard disk is also probably littered with ZIP files or other downloaded archives. For those programs you use, consider moving the archive files to a removable medium for storage. For programs you don't use, delete the archive files.
  • Remove Windows Home Server components that you don't use- If you don't use some Windows Home Server components, use the Control Panel's Add or Remove Programs icon to remove those components from your system.
  • Move documents to the shared folders- Your Administrator account on Windows Home Server has its own My Documents folder, and it's fine to use that folder to store scripts and other local files. However, if you use Windows Home Server to rip audio CDs and DVDs, record TV shows, or work with large database files, your documents can eat up a lot of disk space. If your Windows Home Server storage space is large, you should probably move some or all of your My Documents contents to the shared folders.

After you've performed these tasks, you should run the Disk Cleanup utility, which can automatically remove some of the preceding file categories, as well as several other types of files. Here's how it works:

  1. Select Start, All Programs, Accessories, System Tools, Disk Cleanup. The Select Drive dialog box appears.
  2. In the Drives list, select drive C:. (It should be selected by default.) Disk Cleanup scans the drive to see which files can be deleted and then displays a window.

    Tip: Windows Home Server offers two methods for bypassing the Select Drive dialog box. One method is to right-click drive C: in Windows Explorer, click Properties, and then click the Disk Cleanup button in the General tab of the drive's property sheet. The other method is to select Start, Run, type cleanmgr /dc, and then click OK.

  3. In the Files to Delete list, activate the check box beside each category of file you want to remove. If you're not sure what an item represents, select it and read the text in the Description box. Note, too, that for most of these items, you can click View Files to see what you'll be deleting. In most cases, you see the following items in this list:
    • Downloaded Program Files- These are ActiveX controls and Java applets used by some web pages. Internet Explorer downloads the objects and stores them on your system.
    • Temporary Internet Files- These are copies of web pages that Internet Explorer keeps on hand so that the pages view faster the next time you visit them. Note that deleting these files slows down your web surfing slightly, but you probably won't notice this much if you have a broadband connection.
    • Offline Webpages- These are web pages that you've set up as favorites and for which you've activated the "Make available offline" feature. This means that Internet Explorer stores updated copies of these pages on your computer for offline surfing. Deleting them means that you have to go online to view them.
    • Recycle Bin- These are the files that you've deleted recently. Windows Home Server stores them in the Recycle Bin for a while just in case you delete a file accidentally. If you're sure you don't need to recover a file, you can clean out the Recycle Bin and recover the disk space.
    • Setup Log Files- These are files that Windows Home Server created while it was installing itself on your computer. If your computer is running well, you'll never need to refer to these logs, so you can toss them.
    • Temporary Files- These are files that some programs use to store temporary information. Most programs delete these files automatically, but a program or computer crash could prevent that from happening. You can delete these files at will.
    • Thumbnails- These are smaller versions of pictures, videos, and documents that Windows Home Server stores to display the contents of each folder more quickly. You can delete these safely, but note that Windows Home Server recreates them anyway when you next visit a folder.
    • Microsoft Error Reporting Files- Windows Home Server keeps track of several kinds of files that it uses for reporting errors and checking for solutions to problems. For example, there are Per User Archived Microsoft Error Reporting Files (error reporting files for individual user accounts) and System Archived Microsoft Error Reporting Files (error reporting files for all users). These are temporary files that the Error Reporting service uses. You can safely delete these files.
  4. Click OK. Disk Cleanup asks whether you're sure that you want to delete the files.
  5. Click Yes. Disk Cleanup deletes the selected files.

Saving Disk Cleanup Settings

It's possible to save your Disk Cleanup settings and run them again at any time. This is handy if, for example, you want to delete all your downloaded program files and temporary Internet files at shutdown. Select Start, Command Prompt, and then enter the following command:

cleanmgr /sageset:1

Note that the number 1 in the command is arbitrary. You can enter any number between 0 and 65535. This launches Disk Cleanup with an expanded set of file types to delete. Make your choices, and click OK. What this does is save your settings to the Registry; it doesn't delete the files. To delete the files, open the command prompt and enter the following command:

cleanmgr /sagerun:1

You can also create a shortcut for this command, add it to a batch file, or schedule it with the Task Scheduler.

[Previous] [Contents] [Next]