Contact Info

Crumbtrail

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

Win32_PerfRawData_DNS powershell 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_PerfRawData_DNS WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

$strComputer = "."

$objWMi = get-wmiobject -computername localhost -Namespace root\CIMV2 -Query "Select * from Win32_PerfRawData_DNS_DNS"

foreach ($obj in $objWmi)
{
	write-host "AXFRRequestReceived:" $obj.AXFRRequestReceived
	write-host "AXFRRequestSent:" $obj.AXFRRequestSent
	write-host "AXFRResponseReceived:" $obj.AXFRResponseReceived
	write-host "AXFRSuccessReceived:" $obj.AXFRSuccessReceived
	write-host "AXFRSuccessSent:" $obj.AXFRSuccessSent
	write-host "CachingMemory:" $obj.CachingMemory
	write-host "Caption:" $obj.Caption
	write-host "DatabaseNodeMemory:" $obj.DatabaseNodeMemory
	write-host "Description:" $obj.Description
	write-host "DynamicUpdateNoOperation:" $obj.DynamicUpdateNoOperation
	write-host "DynamicUpdateNoOperationPersec:" $obj.DynamicUpdateNoOperationPersec
	write-host "DynamicUpdateQueued:" $obj.DynamicUpdateQueued
	write-host "DynamicUpdateReceived:" $obj.DynamicUpdateReceived
	write-host "DynamicUpdateReceivedPersec:" $obj.DynamicUpdateReceivedPersec
	write-host "DynamicUpdateRejected:" $obj.DynamicUpdateRejected
	write-host "DynamicUpdateTimeOuts:" $obj.DynamicUpdateTimeOuts
	write-host "DynamicUpdateWrittentoDatabase:" $obj.DynamicUpdateWrittentoDatabase
	write-host "DynamicUpdateWrittentoDatabasePersec:" $obj.DynamicUpdateWrittentoDatabasePersec
	write-host "Frequency_Object:" $obj.Frequency_Object
	write-host "Frequency_PerfTime:" $obj.Frequency_PerfTime
	write-host "Frequency_Sys100NS:" $obj.Frequency_Sys100NS
	write-host "IXFRRequestReceived:" $obj.IXFRRequestReceived
	write-host "IXFRRequestSent:" $obj.IXFRRequestSent
	write-host "IXFRResponseReceived:" $obj.IXFRResponseReceived
	write-host "IXFRSuccessReceived:" $obj.IXFRSuccessReceived
	write-host "IXFRSuccessSent:" $obj.IXFRSuccessSent
	write-host "IXFRTCPSuccessReceived:" $obj.IXFRTCPSuccessReceived
	write-host "IXFRUDPSuccessReceived:" $obj.IXFRUDPSuccessReceived
	write-host "Name:" $obj.Name
	write-host "NbstatMemory:" $obj.NbstatMemory
	write-host "NotifyReceived:" $obj.NotifyReceived
	write-host "NotifySent:" $obj.NotifySent
	write-host "RecordFlowMemory:" $obj.RecordFlowMemory
	write-host "RecursiveQueries:" $obj.RecursiveQueries
	write-host "RecursiveQueriesPersec:" $obj.RecursiveQueriesPersec
	write-host "RecursiveQueryFailure:" $obj.RecursiveQueryFailure
	write-host "RecursiveQueryFailurePersec:" $obj.RecursiveQueryFailurePersec
	write-host "RecursiveSendTimeOuts:" $obj.RecursiveSendTimeOuts
	write-host "RecursiveTimeOutPersec:" $obj.RecursiveTimeOutPersec
	write-host "SecureUpdateFailure:" $obj.SecureUpdateFailure
	write-host "SecureUpdateReceived:" $obj.SecureUpdateReceived
	write-host "SecureUpdateReceivedPersec:" $obj.SecureUpdateReceivedPersec
	write-host "TCPMessageMemory:" $obj.TCPMessageMemory
	write-host "TCPQueryReceived:" $obj.TCPQueryReceived
	write-host "TCPQueryReceivedPersec:" $obj.TCPQueryReceivedPersec
	write-host "TCPResponseSent:" $obj.TCPResponseSent
	write-host "TCPResponseSentPersec:" $obj.TCPResponseSentPersec
	write-host "Timestamp_Object:" $obj.Timestamp_Object
	write-host "Timestamp_PerfTime:" $obj.Timestamp_PerfTime
	write-host "Timestamp_Sys100NS:" $obj.Timestamp_Sys100NS
	write-host "TotalQueryReceived:" $obj.TotalQueryReceived
	write-host "TotalQueryReceivedPersec:" $obj.TotalQueryReceivedPersec
	write-host "TotalResponseSent:" $obj.TotalResponseSent
	write-host "TotalResponseSentPersec:" $obj.TotalResponseSentPersec
	write-host "UDPMessageMemory:" $obj.UDPMessageMemory
	write-host "UDPQueryReceived:" $obj.UDPQueryReceived
	write-host "UDPQueryReceivedPersec:" $obj.UDPQueryReceivedPersec
	write-host "UDPResponseSent:" $obj.UDPResponseSent
	write-host "UDPResponseSentPersec:" $obj.UDPResponseSentPersec
	write-host "UnmatchedResponsesReceived:" $obj.UnmatchedResponsesReceived
	write-host "WINSLookupReceived:" $obj.WINSLookupReceived
	write-host "WINSLookupReceivedPersec:" $obj.WINSLookupReceivedPersec
	write-host "WINSResponseSent:" $obj.WINSResponseSent
	write-host "WINSResponseSentPersec:" $obj.WINSResponseSentPersec
	write-host "WINSReverseLookupReceived:" $obj.WINSReverseLookupReceived
	write-host "WINSReverseLookupReceivedPersec:" $obj.WINSReverseLookupReceivedPersec
	write-host "WINSReverseResponseSent:" $obj.WINSReverseResponseSent
	write-host "WINSReverseResponseSentPersec:" $obj.WINSReverseResponseSentPersec
	write-host "ZoneTransferFailure:" $obj.ZoneTransferFailure
	write-host "ZoneTransferRequestReceived:" $obj.ZoneTransferRequestReceived
	write-host "ZoneTransferSOARequestSent:" $obj.ZoneTransferSOARequestSent
	write-host "ZoneTransferSuccess:" $obj.ZoneTransferSuccess
	write-host
	write-host "########"
	write-host
}