external help file | Module Name | online version | schema |
---|---|---|---|
PSTimers-help.xml |
PSTimers |
2.0.0 |
Stop your simple timer.
Stop-MyTimer [-Name] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
This command will stop any timer created with Start-MyTimer. When executed it which will calculate a final duration timespan, mark the timer as no longer running and remove the timer variable. Although you can still get the timer with Get-Timer.
PS C:\> Stop-MyTimer Timer2
Name : timer2
Start : 12/12/2022 11:09:25 AM
End : 12/12/2022 11:17:34 AM
Duration : 00:08:08.6042323
Description :
Stop a timer called Timer2.
PS C:\> $report = import-csv s:\company.csv | foreach -begin { Start-MyTimer T10; Write-Host "Starting the process" -foreground cyan } -process { Get-CimInstance win32_logicaldisk -computer $_.computername} -end { Write-Host "Finished! $((Stop-MyTimer T10).duration.toString())" -foreground cyan}
Starting the process
Finished!
00:00:29.1625955
Import a list of computers and get disk information for each one. The command uses a timer to measure how long the process took.
Prompt for confirmation before stopping the timer and removing the variable.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
The name for your timer.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: MyTimer
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Using this parameter will display what the final value would be but not actually stop it.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/