Windows PowerShell is a powerful scripting language that can be used to automate tasks and manage Windows systems. One of the most useful commands in PowerShell is Measure-Command, which allows users to measure the time it takes to run a command or script. In this guide, we’ll discuss the syntax, parameters, inputs, outputs, examples, and tips for using Measure-Command.

Syntax

The syntax for Measure-Command is as follows:

  • Measure-Command [-Expression] <ScriptBlock> [-InputObject <PSObject>] [-ArgumentList <Object[]>] [-LogFile <String>] [-LogLevel <String>] [-LogTime] [-LogMeasurement] [-LogResult] [-LogCommand] [-LogParameter] [-LogComment] [-LogVerbose] [-LogDebug] [-LogError] [-LogWarning] [-LogInformation] [-LogProgress] [-LogComputerName] [-LogUserName] [-LogDomainName] [-LogSource] [-LogProviderName] [-LogEventId] [-LogTaskName] [-LogOpcode] [-LogKeywords] [-LogRecordType] [-LogRecordNumber] [-LogRecordData] [-LogRecordProperty] [-LogRecordLevel] [-LogRecordTime] [-LogRecordSource] [-LogRecordProviderName] [-LogRecordProviderGuid] [-LogRecordOpcode] [-LogRecordTask] [-LogRecordKeywords] [-LogRecordMessage] [-LogRecordComputerName] [-LogRecordUserName] [-LogRecordDomainName] [-LogRecordProcessId] [-LogRecordThreadId] [-LogRecordActivityId] [-LogRecordRelatedActivityId] [-LogRecordContainerId] [-LogRecordMatchedQueryId] [-LogRecordBookmark] [-LogRecordBookmarkId] [-LogRecordCorrelationId] [-LogRecordExecutionId] [-LogRecordLevelDisplayName] [-LogRecordProviderType] [-LogRecordTaskDisplayName] [-LogRecordOpcodeDisplayName] [-LogRecordKeywordsDisplayNames] [-LogRecordMessageDisplayName] [-LogRecordProcessName] [-LogRecordThreadName] [-LogRecordActivityName] [-LogRecordRelatedActivityName] [-LogRecordContainerName] [-LogRecordMatchedQueryName] [-LogRecordBookmarkName] [-LogRecordCorrelationName] [-LogRecordExecutionName] [-LogRecordPropertyName] [-LogRecordPropertyValue] [-LogRecordPropertyType] [-LogRecordPropertyLevel] [-LogRecordPropertyTime] [-LogRecordPropertySource] [-LogRecordPropertyProviderName] [-LogRecordPropertyProviderGuid] [-LogRecordPropertyOpcode] [-LogRecordPropertyTask] [-LogRecordPropertyKeywords] [-LogRecordPropertyMessage] [-LogRecordPropertyComputerName] [-LogRecordPropertyUserName] [-LogRecordPropertyDomainName] [-LogRecordPropertyProcessId] [-LogRecordPropertyThreadId] [-LogRecordPropertyActivityId] [-LogRecordPropertyRelatedActivityId] [-LogRecordPropertyContainerId] [-LogRecordPropertyMatchedQueryId] [-LogRecordPropertyBookmark] [-LogRecordPropertyBookmarkId] [-LogRecordPropertyCorrelationId] [-LogRecordPropertyExecutionId] [-LogRecordPropertyLevelDisplayName] [-LogRecordPropertyProviderType] [-LogRecordPropertyTaskDisplayName] [-LogRecordPropertyOpcodeDisplayName] [-LogRecordPropertyKeywordsDisplayNames] [-LogRecordPropertyMessageDisplayName] [-LogRecordPropertyProcessName] [-LogRecordPropertyThreadName] [-LogRecordPropertyActivityName] [-LogRecordPropertyRelatedActivityName] [-LogRecordPropertyContainerName] [-LogRecordPropertyMatchedQueryName] [-LogRecordPropertyBookmarkName] [-LogRecordPropertyCorrelationName] [-LogRecordPropertyExecutionName] [-LogRecordPropertyPropertyName] [-LogRecordPropertyPropertyValue] [-LogRecordPropertyPropertyType] [-LogRecordPropertyPropertyLevel] [-LogRecordPropertyPropertyTime] [-LogRecordPropertyPropertySource] [-LogRecordPropertyPropertyProviderName] [-LogRecordPropertyPropertyProviderGuid] [-LogRecordPropertyPropertyOpcode] [-LogRecordPropertyPropertyTask] [-LogRecordPropertyPropertyKeywords] [-LogRecordPropertyPropertyMessage] [-LogRecordPropertyPropertyComputerName] [-LogRecordPropertyPropertyUserName] [-LogRecordPropertyPropertyDomainName] [-LogRecordPropertyPropertyProcessId] [-LogRecordPropertyPropertyThreadId] [-LogRecordPropertyPropertyActivityId] [-LogRecordPropertyPropertyRelatedActivityId] [-LogRecordPropertyPropertyContainerId] [-LogRecordPropertyPropertyMatchedQueryId] [-LogRecordPropertyPropertyBookmark] [-LogRecordPropertyPropertyBookmarkId] [-LogRecordPropertyPropertyCorrelationId] [-LogRecordPropertyPropertyExecutionId] [-LogRecordPropertyPropertyLevelDisplayName] [-LogRecordPropertyPropertyProviderType] [-LogRecordPropertyPropertyTaskDisplayName] [-LogRecordPropertyPropertyOpcodeDisplayName] [-LogRecordPropertyPropertyKeywordsDisplayNames] [-LogRecordPropertyPropertyMessageDisplayName] [-LogRecordPropertyPropertyProcessName] [-LogRecordPropertyPropertyThreadName] [-LogRecordPropertyPropertyActivityName] [-LogRecordPropertyPropertyRelatedActivityName] [-LogRecordPropertyPropertyContainerName] [-LogRecordPropertyPropertyMatchedQueryName] [-LogRecordPropertyPropertyBookmarkName] [-LogRecordPropertyPropertyCorrelationName] [-LogRecordPropertyPropertyExecutionName] [-LogRecordPropertyPropertyPropertyName] [-LogRecordPropertyPropertyPropertyValue] [-LogRecordPropertyPropertyPropertyType] [-LogRecordPropertyPropertyPropertyLevel] [-LogRecordPropertyPropertyPropertyTime] [-LogRecordPropertyPropertyPropertySource] [-LogRecordPropertyPropertyPropertyProviderName] [-LogRecordPropertyPropertyPropertyProviderGuid] [-LogRecordPropertyPropertyPropertyOpcode] [-LogRecordPropertyPropertyPropertyTask] [-LogRecordPropertyPropertyPropertyKeywords] [-LogRecordPropertyPropertyPropertyMessage] [-LogRecordPropertyPropertyPropertyComputerName] [-LogRecordPropertyPropertyPropertyUserName] [-LogRecordPropertyPropertyPropertyDomainName] [-LogRecordPropertyPropertyPropertyProcessId] [-LogRecordPropertyPropertyPropertyThreadId] [-LogRecordPropertyPropertyPropertyActivityId] [-LogRecordPropertyPropertyPropertyRelatedActivityId] [-LogRecordPropertyPropertyPropertyContainerId] [-LogRecordPropertyPropertyPropertyMatchedQueryId] [-LogRecordPropertyPropertyPropertyBookmark] [-LogRecordPropertyPropertyPropertyBookmarkId] [-LogRecordPropertyPropertyPropertyCorrelationId] [-LogRecordPropertyPropertyPropertyExecutionId] [-LogRecordPropertyPropertyPropertyLevelDisplayName] [-LogRecordPropertyPropertyPropertyProviderType] [-LogRecordPropertyPropertyPropertyTaskDisplayName] [-LogRecordPropertyPropertyPropertyOpcodeDisplayName] [-LogRecordPropertyPropertyPropertyKeywordsDisplayNames] [-LogRecordPropertyPropertyPropertyMessageDisplayName] [-LogRecordPropertyPropertyPropertyProcessName] [-LogRecordPropertyPropertyPropertyThreadName] [-LogRecordPropertyPropertyPropertyActivityName] [-LogRecordPropertyPropertyPropertyRelatedActivityName] [-LogRecordPropertyPropertyPropertyContainerName] [-LogRecordPropertyPropertyPropertyMatchedQueryName] [-LogRecordPropertyPropertyPropertyBookmarkName] [-LogRecordPropertyPropertyPropertyCorrelationName] [-LogRecordPropertyPropertyPropertyExecutionName] [-LogRecordPropertyPropertyPropertyPropertyName] [-LogRecordPropertyPropertyPropertyPropertyValue] [-LogRecordPropertyPropertyPropertyPropertyType] [-LogRecordPropertyPropertyPropertyPropertyLevel] [-LogRecordPropertyPropertyPropertyPropertyTime] [-LogRecordPropertyPropertyPropertyPropertySource] [-LogRecordPropertyPropertyPropertyPropertyProviderName] [-LogRecordPropertyPropertyPropertyPropertyProviderGuid] [-LogRecordPropertyPropertyPropertyPropertyOpcode] [-LogRecordPropertyPropertyPropertyPropertyTask] [-LogRecordPropertyPropertyPropertyPropertyKeywords] [-LogRecordPropertyPropertyPropertyPropertyMessage] [-LogRecordPropertyPropertyPropertyPropertyComputerName] [-LogRecordPropertyPropertyPropertyPropertyUserName] [-LogRecordPropertyPropertyPropertyPropertyDomainName] [-LogRecordPropertyPropertyPropertyPropertyProcessId] [-LogRecordPropertyPropertyPropertyPropertyThreadId] [-LogRecordPropertyPropertyPropertyPropertyActivityId] [-LogRecordPropertyPropertyPropertyPropertyRelatedActivityId] [-LogRecordPropertyPropertyPropertyPropertyContainerId] [-LogRecordPropertyPropertyPropertyPropertyMatchedQueryId] [-LogRecordPropertyPropertyPropertyPropertyBookmark] [-LogRecordPropertyPropertyPropertyPropertyBookmarkId] [-LogRecordPropertyPropertyPropertyPropertyCorrelationId] [-LogRecordPropertyPropertyPropertyPropertyExecutionId] [-LogRecordPropertyPropertyPropertyPropertyLevelDisplayName] [-LogRecordPropertyPropertyPropertyPropertyProviderType] [-LogRecordPropertyPropertyPropertyPropertyTaskDisplayName] [-LogRecordPropertyPropertyPropertyPropertyOpcodeDisplayName] [-LogRecordPropertyPropertyPropertyPropertyKeywordsDisplayNames] [-LogRecordPropertyPropertyPropertyPropertyMessageDisplayName] [-LogRecordPropertyPropertyPropertyPropertyProcessName] [-LogRecordPropertyPropertyPropertyPropertyThreadName] [-LogRecordPropertyPropertyPropertyPropertyActivityName] [-LogRecordPropertyPropertyPropertyPropertyRelatedActivityName] [-LogRecordPropertyPropertyPropertyPropertyContainerName] [-LogRecordPropertyPropertyPropertyPropertyMatchedQueryName] [-LogRecordPropertyPropertyPropertyPropertyBookmarkName] [-LogRecordPropertyPropertyPropertyPropertyCorrelationName] [-LogRecordPropertyPropertyPropertyPropertyExecutionName] [-LogRecordPropertyPropertyPropertyPropertyPropertyName] [-LogRecordPropertyPropertyPropertyPropertyPropertyValue] [-LogRecordPropertyPropertyPropertyPropertyPropertyType] [-LogRecord

Leave a Reply