Contact Info

Crumbtrail

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

Win32_PerfFormattedData_DirectoryServices 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_PerfFormattedData_DirectoryServices 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_PerfFormattedData_DirectoryServices_DirectoryServices"

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