Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » WMI » python sample

Win32_PerfFormattedData_PerfProc_ProcessAddressSpace python sample code

The foundations for Manageability in Windows is Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself. The Win32_PerfFormattedData_PerfProc_ProcessAddressSpace WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

from win32com.client import GetObject
objWMI = GetObject('winmgmts:').InstancesOf('Win32_PerfFormattedData_PerfProc_ProcessAddressSpace_Costly')

for obj in objWMI:
	if obj.BytesFree != None:
		print("BytesFree:" + str(obj.BytesFree))
	if obj.BytesImageFree != None:
		print("BytesImageFree:" + str(obj.BytesImageFree))
	if obj.BytesImageReserved != None:
		print("BytesImageReserved:" + str(obj.BytesImageReserved))
	if obj.BytesReserved != None:
		print("BytesReserved:" + str(obj.BytesReserved))
	if obj.Caption != None:
		print("Caption:" + str(obj.Caption))
	if obj.Description != None:
		print("Description:" + str(obj.Description))
	if obj.Frequency_Object != None:
		print("Frequency_Object:" + str(obj.Frequency_Object))
	if obj.Frequency_PerfTime != None:
		print("Frequency_PerfTime:" + str(obj.Frequency_PerfTime))
	if obj.Frequency_Sys100NS != None:
		print("Frequency_Sys100NS:" + str(obj.Frequency_Sys100NS))
	if obj.IDProcess != None:
		print("IDProcess:" + str(obj.IDProcess))
	if obj.ImageSpaceExecReadOnly != None:
		print("ImageSpaceExecReadOnly:" + str(obj.ImageSpaceExecReadOnly))
	if obj.ImageSpaceExecReadPerWrite != None:
		print("ImageSpaceExecReadPerWrite:" + str(obj.ImageSpaceExecReadPerWrite))
	if obj.ImageSpaceExecutable != None:
		print("ImageSpaceExecutable:" + str(obj.ImageSpaceExecutable))
	if obj.ImageSpaceExecWriteCopy != None:
		print("ImageSpaceExecWriteCopy:" + str(obj.ImageSpaceExecWriteCopy))
	if obj.ImageSpaceNoAccess != None:
		print("ImageSpaceNoAccess:" + str(obj.ImageSpaceNoAccess))
	if obj.ImageSpaceReadOnly != None:
		print("ImageSpaceReadOnly:" + str(obj.ImageSpaceReadOnly))
	if obj.ImageSpaceReadPerWrite != None:
		print("ImageSpaceReadPerWrite:" + str(obj.ImageSpaceReadPerWrite))
	if obj.ImageSpaceWriteCopy != None:
		print("ImageSpaceWriteCopy:" + str(obj.ImageSpaceWriteCopy))
	if obj.MappedSpaceExecReadOnly != None:
		print("MappedSpaceExecReadOnly:" + str(obj.MappedSpaceExecReadOnly))
	if obj.MappedSpaceExecReadPerWrite != None:
		print("MappedSpaceExecReadPerWrite:" + str(obj.MappedSpaceExecReadPerWrite))
	if obj.MappedSpaceExecutable != None:
		print("MappedSpaceExecutable:" + str(obj.MappedSpaceExecutable))
	if obj.MappedSpaceExecWriteCopy != None:
		print("MappedSpaceExecWriteCopy:" + str(obj.MappedSpaceExecWriteCopy))
	if obj.MappedSpaceNoAccess != None:
		print("MappedSpaceNoAccess:" + str(obj.MappedSpaceNoAccess))
	if obj.MappedSpaceReadOnly != None:
		print("MappedSpaceReadOnly:" + str(obj.MappedSpaceReadOnly))
	if obj.MappedSpaceReadPerWrite != None:
		print("MappedSpaceReadPerWrite:" + str(obj.MappedSpaceReadPerWrite))
	if obj.MappedSpaceWriteCopy != None:
		print("MappedSpaceWriteCopy:" + str(obj.MappedSpaceWriteCopy))
	if obj.Name != None:
		print("Name:" + str(obj.Name))
	if obj.ReservedSpaceExecReadOnly != None:
		print("ReservedSpaceExecReadOnly:" + str(obj.ReservedSpaceExecReadOnly))
	if obj.ReservedSpaceExecReadPerWrite != None:
		print("ReservedSpaceExecReadPerWrite:" + str(obj.ReservedSpaceExecReadPerWrite))
	if obj.ReservedSpaceExecutable != None:
		print("ReservedSpaceExecutable:" + str(obj.ReservedSpaceExecutable))
	if obj.ReservedSpaceExecWriteCopy != None:
		print("ReservedSpaceExecWriteCopy:" + str(obj.ReservedSpaceExecWriteCopy))
	if obj.ReservedSpaceNoAccess != None:
		print("ReservedSpaceNoAccess:" + str(obj.ReservedSpaceNoAccess))
	if obj.ReservedSpaceReadOnly != None:
		print("ReservedSpaceReadOnly:" + str(obj.ReservedSpaceReadOnly))
	if obj.ReservedSpaceReadPerWrite != None:
		print("ReservedSpaceReadPerWrite:" + str(obj.ReservedSpaceReadPerWrite))
	if obj.ReservedSpaceWriteCopy != None:
		print("ReservedSpaceWriteCopy:" + str(obj.ReservedSpaceWriteCopy))
	if obj.Timestamp_Object != None:
		print("Timestamp_Object:" + str(obj.Timestamp_Object))
	if obj.Timestamp_PerfTime != None:
		print("Timestamp_PerfTime:" + str(obj.Timestamp_PerfTime))
	if obj.Timestamp_Sys100NS != None:
		print("Timestamp_Sys100NS:" + str(obj.Timestamp_Sys100NS))
	if obj.UnassignedSpaceExecReadOnly != None:
		print("UnassignedSpaceExecReadOnly:" + str(obj.UnassignedSpaceExecReadOnly))
	if obj.UnassignedSpaceExecReadPerWrite != None:
		print("UnassignedSpaceExecReadPerWrite:" + str(obj.UnassignedSpaceExecReadPerWrite))
	if obj.UnassignedSpaceExecutable != None:
		print("UnassignedSpaceExecutable:" + str(obj.UnassignedSpaceExecutable))
	if obj.UnassignedSpaceExecWriteCopy != None:
		print("UnassignedSpaceExecWriteCopy:" + str(obj.UnassignedSpaceExecWriteCopy))
	if obj.UnassignedSpaceNoAccess != None:
		print("UnassignedSpaceNoAccess:" + str(obj.UnassignedSpaceNoAccess))
	if obj.UnassignedSpaceReadOnly != None:
		print("UnassignedSpaceReadOnly:" + str(obj.UnassignedSpaceReadOnly))
	if obj.UnassignedSpaceReadPerWrite != None:
		print("UnassignedSpaceReadPerWrite:" + str(obj.UnassignedSpaceReadPerWrite))
	if obj.UnassignedSpaceWriteCopy != None:
		print("UnassignedSpaceWriteCopy:" + str(obj.UnassignedSpaceWriteCopy))
	print("")
	print("########")
	print("")