Returns information about both the internal and external cache memory on a computer.

This script was tested using Python 2.2.2-224 for Microsoft Windows, available from ActiveState.

import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_CacheMemory")
for objItem in colItems:
    print "Access: ", objItem.Access
    z = objItem.AdditionalErrorData
    if z is None:
        a = 1
        for x in z:
            print "Additional Error Data: ", x
    print "Associativity: ", objItem.Associativity
    print "Availability: ", objItem.Availability
    print "Block Size: ", objItem.BlockSize
    print "Cache Speed: ", objItem.CacheSpeed
    print "Cache Type: ", objItem.CacheType
    print "Caption: ", objItem.Caption
    print "Config Manager Error Code: ", objItem.ConfigManagerErrorCode
    print "Config Manager User Config: ", objItem.ConfigManagerUserConfig
    print "Correctable Error: ", objItem.CorrectableError
    print "Creation Class Name: ", objItem.CreationClassName
    z = objItem.CurrentSRAM
    if z is None:
        a = 1
        for x in z:
            print "Current SRAM: ", x
    print "Description: ", objItem.Description
    print "Device ID: ", objItem.DeviceID
    print "Ending Address: ", objItem.EndingAddress
    print "Error Access: ", objItem.ErrorAccess
    print "Error Address: ", objItem.ErrorAddress
    print "Error Cleared: ", objItem.ErrorCleared
    print "Error Correct Type: ", objItem.ErrorCorrectType
    z = objItem.ErrorData
    if z is None:
        a = 1
        for x in z:
            print "Error Data: ", x
    print "Error Data Order: ", objItem.ErrorDataOrder
    print "Error Description: ", objItem.ErrorDescription
    print "Error Info: ", objItem.ErrorInfo
    print "Error Methodology: ", objItem.ErrorMethodology
    print "Error Resolution: ", objItem.ErrorResolution
    print "Error Time: ", objItem.ErrorTime
    print "Error Transfer Size: ", objItem.ErrorTransferSize
    print "Flush Timer: ", objItem.FlushTimer
    print "Install Date: ", objItem.InstallDate
    print "Installed Size: ", objItem.InstalledSize
    print "Last Error Code: ", objItem.LastErrorCode
    print "Level: ", objItem.Level
    print "Line Size: ", objItem.LineSize
    print "Location: ", objItem.Location
    print "Max Cache Size: ", objItem.MaxCacheSize
    print "Name: ", objItem.Name
    print "Number Of Blocks: ", objItem.NumberOfBlocks
    print "Other Error Description: ", objItem.OtherErrorDescription
    print "PNP Device ID: ", objItem.PNPDeviceID
    z = objItem.PowerManagementCapabilities
    if z is None:
        a = 1
        for x in z:
            print "Power Management Capabilities: ", x
    print "Power Management Supported: ", objItem.PowerManagementSupported
    print "Purpose: ", objItem.Purpose
    print "Read Policy: ", objItem.ReadPolicy
    print "Replacement Policy: ", objItem.ReplacementPolicy
    print "Starting Address: ", objItem.StartingAddress
    print "Status: ", objItem.Status
    print "Status Info: ", objItem.StatusInfo
    z = objItem.SupportedSRAM
    if z is None:
        a = 1
        for x in z:
            print "Supported SRAM: ", x
    print "System Creation Class Name: ", objItem.SystemCreationClassName
    print "System Level Address: ", objItem.SystemLevelAddress
    print "System Name: ", objItem.SystemName
    print "Write Policy: ", objItem.WritePolicy