Werbung

Herkunft

Kurzinformation

Stops a PowerShell Command

Syntax

<# .Synopsis Stops a PowerShell Command .Description Stops a PowerShell command that has been Registered with Register-PowerShellCommand .Parameter name The name of the command to stop .Example New-Grid -Rows 2 -Columns 2 -On_Loaded { Register-PowerShellCommand -name UpdateClock -scriptBlock { $stopWatch = $window | Get-ChildControl StopWatch $stopWatch.Content = [Datetime]::Now - $stopWatch.Tag } } { New-Label -Name Stopwatch "0:0:0" -ColumnSpan 2 New-Button -Row 1 -Column 0 Start -On_Click { $window | Get-ChildControl StopWatch | ForEach-Object { $_.Tag = Get-Date } Start-PowerShellCommand "UpdateClock" -interval ([Timespan]::FromMilliseconds(25)) } New-Button -Row 1 -Column 1 Stop -On_Click { Stop-PowerShellCommand "UpdateClock" } } -show #> param( [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true,Position=0)] $name ) process { if ($window) { if ($window.Resources.Scripts.$Name) { if ($window.Resources.Timers."Run-$name") { $window.Resources.Timers."Run-$Name" | ForEach-Object { if ($_) { $_.Stop() } } } } } }

Beschreibung

Stops a PowerShell command that has been Registered with Register-PowerShellCommand

Links

Liste aller Commandlets Mehr über die Windows PowerShell

Bücher zur PowerShell

Buchcover Windows PowerShell 5.0 - Das Praxishandbuch (1. Auflage 2016/5. Auflage Gesamtreihe) Windows PowerShell 5.0 - Das Praxishandbuch (1. Auflage 2016/5. Auflage Gesamtreihe)
Autoren: Dr. Holger Schwichtenberg
erschienen 2016, 996 Seiten, 49,99 €
ISBN: 3446446435
Bestellung: Amazon.de oder im Buchhandel über ISBN 3446446435

Schulungen/Seminare

Offene Seminare zur PowerShell
In-House-Seminare zur PowerShell