Contact Info

Crumbtrail

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

Win32_PerfRawData_DirectoryServices perl 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_DirectoryServices WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


Sample Code

use Win32::OLE('in');

my $computer = ".";

my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n";
my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_PerfRawData_DirectoryServices_DirectoryServices", "WQL");

foreach my $objItem (in $colItems) {
	print "ABANRPersec: $objItem->{ABANRPersec}\n";
	print "ABBrowsesPersec: $objItem->{ABBrowsesPersec}\n";
	print "ABClientSessions: $objItem->{ABClientSessions}\n";
	print "ABMatchesPersec: $objItem->{ABMatchesPersec}\n";
	print "ABPropertyReadsPersec: $objItem->{ABPropertyReadsPersec}\n";
	print "ABProxyLookupsPersec: $objItem->{ABProxyLookupsPersec}\n";
	print "ABSearchesPersec: $objItem->{ABSearchesPersec}\n";
	print "ATQEstimatedQueueDelay: $objItem->{ATQEstimatedQueueDelay}\n";
	print "ATQOutstandingQueuedRequests: $objItem->{ATQOutstandingQueuedRequests}\n";
	print "ATQRequestLatency: $objItem->{ATQRequestLatency}\n";
	print "ATQThreadsLDAP: $objItem->{ATQThreadsLDAP}\n";
	print "ATQThreadsOther: $objItem->{ATQThreadsOther}\n";
	print "ATQThreadsTotal: $objItem->{ATQThreadsTotal}\n";
	print "BasesearchesPersec: $objItem->{BasesearchesPersec}\n";
	print "Caption: $objItem->{Caption}\n";
	print "DatabaseaddsPersec: $objItem->{DatabaseaddsPersec}\n";
	print "DatabasedeletesPersec: $objItem->{DatabasedeletesPersec}\n";
	print "DatabasemodifysPersec: $objItem->{DatabasemodifysPersec}\n";
	print "Description: $objItem->{Description}\n";
	print "DigestBindsPersec: $objItem->{DigestBindsPersec}\n";
	print "DRAHighestUSNCommittedHighpart: $objItem->{DRAHighestUSNCommittedHighpart}\n";
	print "DRAHighestUSNCommittedLowpart: $objItem->{DRAHighestUSNCommittedLowpart}\n";
	print "DRAHighestUSNIssuedHighpart: $objItem->{DRAHighestUSNIssuedHighpart}\n";
	print "DRAHighestUSNIssuedLowpart: $objItem->{DRAHighestUSNIssuedLowpart}\n";
	print "DRAInboundBytesCompressedBetweenSitesAfterCompressionPersec: $objItem->{DRAInboundBytesCompressedBetweenSitesAfterCompressionPersec}\n";
	print "DRAInboundBytesCompressedBetweenSitesAfterCompressionSinceBoot: $objItem->{DRAInboundBytesCompressedBetweenSitesAfterCompressionSinceBoot}\n";
	print "DRAInboundBytesCompressedBetweenSitesBeforeCompressionPersec: $objItem->{DRAInboundBytesCompressedBetweenSitesBeforeCompressionPersec}\n";
	print "DRAInboundBytesCompressedBetweenSitesBeforeCompressionSinceBoot: $objItem->{DRAInboundBytesCompressedBetweenSitesBeforeCompressionSinceBoot}\n";
	print "DRAInboundBytesNotCompressedWithinSitePersec: $objItem->{DRAInboundBytesNotCompressedWithinSitePersec}\n";
	print "DRAInboundBytesNotCompressedWithinSiteSinceBoot: $objItem->{DRAInboundBytesNotCompressedWithinSiteSinceBoot}\n";
	print "DRAInboundBytesTotalPersec: $objItem->{DRAInboundBytesTotalPersec}\n";
	print "DRAInboundBytesTotalSinceBoot: $objItem->{DRAInboundBytesTotalSinceBoot}\n";
	print "DRAInboundFullSyncObjectsRemaining: $objItem->{DRAInboundFullSyncObjectsRemaining}\n";
	print "DRAInboundLinkValueUpdatesRemaininginPacket: $objItem->{DRAInboundLinkValueUpdatesRemaininginPacket}\n";
	print "DRAInboundObjectsAppliedPersec: $objItem->{DRAInboundObjectsAppliedPersec}\n";
	print "DRAInboundObjectsFilteredPersec: $objItem->{DRAInboundObjectsFilteredPersec}\n";
	print "DRAInboundObjectsPersec: $objItem->{DRAInboundObjectsPersec}\n";
	print "DRAInboundObjectUpdatesRemaininginPacket: $objItem->{DRAInboundObjectUpdatesRemaininginPacket}\n";
	print "DRAInboundPropertiesAppliedPersec: $objItem->{DRAInboundPropertiesAppliedPersec}\n";
	print "DRAInboundPropertiesFilteredPersec: $objItem->{DRAInboundPropertiesFilteredPersec}\n";
	print "DRAInboundPropertiesTotalPersec: $objItem->{DRAInboundPropertiesTotalPersec}\n";
	print "DRAInboundTotalUpdatesRemaininginPacket: $objItem->{DRAInboundTotalUpdatesRemaininginPacket}\n";
	print "DRAInboundValuesDNsonlyPersec: $objItem->{DRAInboundValuesDNsonlyPersec}\n";
	print "DRAInboundValuesTotalPersec: $objItem->{DRAInboundValuesTotalPersec}\n";
	print "DRAOutboundBytesCompressedBetweenSitesAfterCompressionPersec: $objItem->{DRAOutboundBytesCompressedBetweenSitesAfterCompressionPersec}\n";
	print "DRAOutboundBytesCompressedBetweenSitesAfterCompressionSinceBoot: $objItem->{DRAOutboundBytesCompressedBetweenSitesAfterCompressionSinceBoot}\n";
	print "DRAOutboundBytesCompressedBetweenSitesBeforeCompressionPersec: $objItem->{DRAOutboundBytesCompressedBetweenSitesBeforeCompressionPersec}\n";
	print "DRAOutboundBytesCompressedBetweenSitesBeforeCompressionSinceBoot: $objItem->{DRAOutboundBytesCompressedBetweenSitesBeforeCompressionSinceBoot}\n";
	print "DRAOutboundBytesNotCompressedWithinSitePersec: $objItem->{DRAOutboundBytesNotCompressedWithinSitePersec}\n";
	print "DRAOutboundBytesNotCompressedWithinSiteSinceBoot: $objItem->{DRAOutboundBytesNotCompressedWithinSiteSinceBoot}\n";
	print "DRAOutboundBytesTotalPersec: $objItem->{DRAOutboundBytesTotalPersec}\n";
	print "DRAOutboundBytesTotalSinceBoot: $objItem->{DRAOutboundBytesTotalSinceBoot}\n";
	print "DRAOutboundObjectsFilteredPersec: $objItem->{DRAOutboundObjectsFilteredPersec}\n";
	print "DRAOutboundObjectsPersec: $objItem->{DRAOutboundObjectsPersec}\n";
	print "DRAOutboundPropertiesPersec: $objItem->{DRAOutboundPropertiesPersec}\n";
	print "DRAOutboundValuesDNsonlyPersec: $objItem->{DRAOutboundValuesDNsonlyPersec}\n";
	print "DRAOutboundValuesTotalPersec: $objItem->{DRAOutboundValuesTotalPersec}\n";
	print "DRAPendingReplicationOperations: $objItem->{DRAPendingReplicationOperations}\n";
	print "DRAPendingReplicationSynchronizations: $objItem->{DRAPendingReplicationSynchronizations}\n";
	print "DRASyncFailuresonSchemaMismatch: $objItem->{DRASyncFailuresonSchemaMismatch}\n";
	print "DRASyncRequestsMade: $objItem->{DRASyncRequestsMade}\n";
	print "DRASyncRequestsSuccessful: $objItem->{DRASyncRequestsSuccessful}\n";
	print "DRAThreadsGettingNCChanges: $objItem->{DRAThreadsGettingNCChanges}\n";
	print "DRAThreadsGettingNCChangesHoldingSemaphore: $objItem->{DRAThreadsGettingNCChangesHoldingSemaphore}\n";
	print "DSClientBindsPersec: $objItem->{DSClientBindsPersec}\n";
	print "DSClientNameTranslationsPersec: $objItem->{DSClientNameTranslationsPersec}\n";
	print "DSDirectoryReadsPersec: $objItem->{DSDirectoryReadsPersec}\n";
	print "DSDirectorySearchesPersec: $objItem->{DSDirectorySearchesPersec}\n";
	print "DSDirectoryWritesPersec: $objItem->{DSDirectoryWritesPersec}\n";
	print "DSMonitorListSize: $objItem->{DSMonitorListSize}\n";
	print "DSNameCachehitrate: $objItem->{DSNameCachehitrate}\n";
	print "DSNameCachehitrate_Base: $objItem->{DSNameCachehitrate_Base}\n";
	print "DSNotifyQueueSize: $objItem->{DSNotifyQueueSize}\n";
	print "DSPercentReadsfromDRA: $objItem->{DSPercentReadsfromDRA}\n";
	print "DSPercentReadsfromDRA_Base: $objItem->{DSPercentReadsfromDRA_Base}\n";
	print "DSPercentReadsfromKCC: $objItem->{DSPercentReadsfromKCC}\n";
	print "DSPercentReadsfromKCC_Base: $objItem->{DSPercentReadsfromKCC_Base}\n";
	print "DSPercentReadsfromLSA: $objItem->{DSPercentReadsfromLSA}\n";
	print "DSPercentReadsfromLSA_Base: $objItem->{DSPercentReadsfromLSA_Base}\n";
	print "DSPercentReadsfromNSPI: $objItem->{DSPercentReadsfromNSPI}\n";
	print "DSPercentReadsfromNSPI_Base: $objItem->{DSPercentReadsfromNSPI_Base}\n";
	print "DSPercentReadsfromNTDSAPI: $objItem->{DSPercentReadsfromNTDSAPI}\n";
	print "DSPercentReadsfromNTDSAPI_Base: $objItem->{DSPercentReadsfromNTDSAPI_Base}\n";
	print "DSPercentReadsfromSAM: $objItem->{DSPercentReadsfromSAM}\n";
	print "DSPercentReadsfromSAM_Base: $objItem->{DSPercentReadsfromSAM_Base}\n";
	print "DSPercentReadsOther: $objItem->{DSPercentReadsOther}\n";
	print "DSPercentReadsOther_Base: $objItem->{DSPercentReadsOther_Base}\n";
	print "DSPercentSearchesfromDRA: $objItem->{DSPercentSearchesfromDRA}\n";
	print "DSPercentSearchesfromDRA_Base: $objItem->{DSPercentSearchesfromDRA_Base}\n";
	print "DSPercentSearchesfromKCC: $objItem->{DSPercentSearchesfromKCC}\n";
	print "DSPercentSearchesfromKCC_Base: $objItem->{DSPercentSearchesfromKCC_Base}\n";
	print "DSPercentSearchesfromLDAP: $objItem->{DSPercentSearchesfromLDAP}\n";
	print "DSPercentSearchesfromLDAP_Base: $objItem->{DSPercentSearchesfromLDAP_Base}\n";
	print "DSPercentSearchesfromLSA: $objItem->{DSPercentSearchesfromLSA}\n";
	print "DSPercentSearchesfromLSA_Base: $objItem->{DSPercentSearchesfromLSA_Base}\n";
	print "DSPercentSearchesfromNSPI: $objItem->{DSPercentSearchesfromNSPI}\n";
	print "DSPercentSearchesfromNSPI_Base: $objItem->{DSPercentSearchesfromNSPI_Base}\n";
	print "DSPercentSearchesfromNTDSAPI: $objItem->{DSPercentSearchesfromNTDSAPI}\n";
	print "DSPercentSearchesfromNTDSAPI_Base: $objItem->{DSPercentSearchesfromNTDSAPI_Base}\n";
	print "DSPercentSearchesfromSAM: $objItem->{DSPercentSearchesfromSAM}\n";
	print "DSPercentSearchesfromSAM_Base: $objItem->{DSPercentSearchesfromSAM_Base}\n";
	print "DSPercentSearchesOther: $objItem->{DSPercentSearchesOther}\n";
	print "DSPercentSearchesOther_Base: $objItem->{DSPercentSearchesOther_Base}\n";
	print "DSPercentWritesfromDRA: $objItem->{DSPercentWritesfromDRA}\n";
	print "DSPercentWritesfromDRA_Base: $objItem->{DSPercentWritesfromDRA_Base}\n";
	print "DSPercentWritesfromKCC: $objItem->{DSPercentWritesfromKCC}\n";
	print "DSPercentWritesfromKCC_Base: $objItem->{DSPercentWritesfromKCC_Base}\n";
	print "DSPercentWritesfromLDAP: $objItem->{DSPercentWritesfromLDAP}\n";
	print "DSPercentWritesfromLDAP_Base: $objItem->{DSPercentWritesfromLDAP_Base}\n";
	print "DSPercentWritesfromLSA: $objItem->{DSPercentWritesfromLSA}\n";
	print "DSPercentWritesfromLSA_Base: $objItem->{DSPercentWritesfromLSA_Base}\n";
	print "DSPercentWritesfromNSPI: $objItem->{DSPercentWritesfromNSPI}\n";
	print "DSPercentWritesfromNSPI_Base: $objItem->{DSPercentWritesfromNSPI_Base}\n";
	print "DSPercentWritesfromNTDSAPI: $objItem->{DSPercentWritesfromNTDSAPI}\n";
	print "DSPercentWritesfromNTDSAPI_Base: $objItem->{DSPercentWritesfromNTDSAPI_Base}\n";
	print "DSPercentWritesfromSAM: $objItem->{DSPercentWritesfromSAM}\n";
	print "DSPercentWritesfromSAM_Base: $objItem->{DSPercentWritesfromSAM_Base}\n";
	print "DSPercentWritesOther: $objItem->{DSPercentWritesOther}\n";
	print "DSPercentWritesOther_Base: $objItem->{DSPercentWritesOther_Base}\n";
	print "DSSearchsuboperationsPersec: $objItem->{DSSearchsuboperationsPersec}\n";
	print "DSSecurityDescriptorPropagationsEvents: $objItem->{DSSecurityDescriptorPropagationsEvents}\n";
	print "DSSecurityDescriptorPropagatorAverageExclusionTime: $objItem->{DSSecurityDescriptorPropagatorAverageExclusionTime}\n";
	print "DSSecurityDescriptorPropagatorRuntimeQueue: $objItem->{DSSecurityDescriptorPropagatorRuntimeQueue}\n";
	print "DSSecurityDescriptorsuboperationsPersec: $objItem->{DSSecurityDescriptorsuboperationsPersec}\n";
	print "DSServerBindsPersec: $objItem->{DSServerBindsPersec}\n";
	print "DSServerNameTranslationsPersec: $objItem->{DSServerNameTranslationsPersec}\n";
	print "DSThreadsinUse: $objItem->{DSThreadsinUse}\n";
	print "ExternalBindsPersec: $objItem->{ExternalBindsPersec}\n";
	print "FastBindsPersec: $objItem->{FastBindsPersec}\n";
	print "Frequency_Object: $objItem->{Frequency_Object}\n";
	print "Frequency_PerfTime: $objItem->{Frequency_PerfTime}\n";
	print "Frequency_Sys100NS: $objItem->{Frequency_Sys100NS}\n";
	print "LDAPActiveThreads: $objItem->{LDAPActiveThreads}\n";
	print "LDAPBindTime: $objItem->{LDAPBindTime}\n";
	print "LDAPClientSessions: $objItem->{LDAPClientSessions}\n";
	print "LDAPClosedConnectionsPersec: $objItem->{LDAPClosedConnectionsPersec}\n";
	print "LDAPNewConnectionsPersec: $objItem->{LDAPNewConnectionsPersec}\n";
	print "LDAPNewSSLConnectionsPersec: $objItem->{LDAPNewSSLConnectionsPersec}\n";
	print "LDAPSearchesPersec: $objItem->{LDAPSearchesPersec}\n";
	print "LDAPSuccessfulBindsPersec: $objItem->{LDAPSuccessfulBindsPersec}\n";
	print "LDAPUDPoperationsPersec: $objItem->{LDAPUDPoperationsPersec}\n";
	print "LDAPWritesPersec: $objItem->{LDAPWritesPersec}\n";
	print "LinkValuesCleanedPersec: $objItem->{LinkValuesCleanedPersec}\n";
	print "Name: $objItem->{Name}\n";
	print "NegotiatedBindsPersec: $objItem->{NegotiatedBindsPersec}\n";
	print "NTLMBindsPersec: $objItem->{NTLMBindsPersec}\n";
	print "OnelevelsearchesPersec: $objItem->{OnelevelsearchesPersec}\n";
	print "PhantomsCleanedPersec: $objItem->{PhantomsCleanedPersec}\n";
	print "PhantomsVisitedPersec: $objItem->{PhantomsVisitedPersec}\n";
	print "SAMAccountGroupEvaluationLatency: $objItem->{SAMAccountGroupEvaluationLatency}\n";
	print "SAMDisplayInformationQueriesPersec: $objItem->{SAMDisplayInformationQueriesPersec}\n";
	print "SAMDomainLocalGroupMembershipEvaluationsPersec: $objItem->{SAMDomainLocalGroupMembershipEvaluationsPersec}\n";
	print "SAMEnumerationsPersec: $objItem->{SAMEnumerationsPersec}\n";
	print "SAMGCEvaluationsPersec: $objItem->{SAMGCEvaluationsPersec}\n";
	print "SAMGlobalGroupMembershipEvaluationsPersec: $objItem->{SAMGlobalGroupMembershipEvaluationsPersec}\n";
	print "SAMMachineCreationAttemptsPersec: $objItem->{SAMMachineCreationAttemptsPersec}\n";
	print "SAMMembershipChangesPersec: $objItem->{SAMMembershipChangesPersec}\n";
	print "SAMNonTransitiveMembershipEvaluationsPersec: $objItem->{SAMNonTransitiveMembershipEvaluationsPersec}\n";
	print "SAMPasswordChangesPersec: $objItem->{SAMPasswordChangesPersec}\n";
	print "SAMResourceGroupEvaluationLatency: $objItem->{SAMResourceGroupEvaluationLatency}\n";
	print "SAMSuccessfulComputerCreationsPersecIncludesallrequests: $objItem->{SAMSuccessfulComputerCreationsPersecIncludesallrequests}\n";
	print "SAMSuccessfulUserCreationsPersec: $objItem->{SAMSuccessfulUserCreationsPersec}\n";
	print "SAMTransitiveMembershipEvaluationsPersec: $objItem->{SAMTransitiveMembershipEvaluationsPersec}\n";
	print "SAMUniversalGroupMembershipEvaluationsPersec: $objItem->{SAMUniversalGroupMembershipEvaluationsPersec}\n";
	print "SAMUserCreationAttemptsPersec: $objItem->{SAMUserCreationAttemptsPersec}\n";
	print "SimpleBindsPersec: $objItem->{SimpleBindsPersec}\n";
	print "SubtreesearchesPersec: $objItem->{SubtreesearchesPersec}\n";
	print "Timestamp_Object: $objItem->{Timestamp_Object}\n";
	print "Timestamp_PerfTime: $objItem->{Timestamp_PerfTime}\n";
	print "Timestamp_Sys100NS: $objItem->{Timestamp_Sys100NS}\n";
	print "TombstonesGarbageCollectedPersec: $objItem->{TombstonesGarbageCollectedPersec}\n";
	print "TombstonesVisitedPersec: $objItem->{TombstonesVisitedPersec}\n";
	print "\n";
	print "########\n";
	print "\n";
}