All Projects → markwragg → PowerShell-Watch

markwragg / PowerShell-Watch

Licence: other
A PowerShell Watch-Command cmdlet for repeatedly running a command or block of code until a change in the output occurs.

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to PowerShell-Watch

Apple Device Model List
All Apple devices model name list. 通过内部编号判断 iOS 设备型号。
Stars: ✭ 149 (+204.08%)
Mutual labels:  watch
My Ttgo Watch
Firmware for a ttgo-watch2020-v1 smartwatch based on ESP32 from LilyGo.
Stars: ✭ 192 (+291.84%)
Mutual labels:  watch
powervrni
PowervRNI: A PowerShell module to talk to the vRealize Network Insight API
Stars: ✭ 19 (-61.22%)
Mutual labels:  cmdlet
Hitrava
Convert your Huawei Health sport activities and import them in Strava.
Stars: ✭ 156 (+218.37%)
Mutual labels:  watch
Beefun Pro
Github client for iOS in Swift.
Stars: ✭ 172 (+251.02%)
Mutual labels:  watch
Node Inotify
Inotify bindings for Node.JS
Stars: ✭ 237 (+383.67%)
Mutual labels:  watch
Funzzy
Yet another fancy watcher. (Rust)
Stars: ✭ 142 (+189.8%)
Mutual labels:  watch
jtl-reporter
JtlReporter is an online application that allows users to generate beautiful, customizable and easy to understand performance reports from JMeter(Taurus), Locust, and other tools.
Stars: ✭ 85 (+73.47%)
Mutual labels:  comparison
Newpipe
A libre lightweight streaming front-end for Android.
Stars: ✭ 15,786 (+32116.33%)
Mutual labels:  watch
PowerShell
A collection of useful PowerShell modules and scripts.
Stars: ✭ 37 (-24.49%)
Mutual labels:  cmdlet
Eslint Watch
ESLint with simple watching capabilities
Stars: ✭ 159 (+224.49%)
Mutual labels:  watch
Js Must Watch
Must-watch videos about javascript
Stars: ✭ 12,696 (+25810.2%)
Mutual labels:  watch
Every Single Day I Tldr
A daily digest of the articles or videos I've found interesting, that I want to share with you.
Stars: ✭ 249 (+408.16%)
Mutual labels:  watch
Witness
Monitor file system events using Swift
Stars: ✭ 150 (+206.12%)
Mutual labels:  watch
testing-in-bash
Bash test framework comparison
Stars: ✭ 98 (+100%)
Mutual labels:  comparison
Klap
zero config, zero dependency bundler for tiny javascript packages
Stars: ✭ 143 (+191.84%)
Mutual labels:  watch
Redux Subscriber
Subscribe to changes in any part of redux state
Stars: ✭ 205 (+318.37%)
Mutual labels:  watch
benchmark VAE
Unifying Variational Autoencoder (VAE) implementations in Pytorch (NeurIPS 2022)
Stars: ✭ 1,211 (+2371.43%)
Mutual labels:  comparison
ytmous
Anonymous Youtube Proxy
Stars: ✭ 60 (+22.45%)
Mutual labels:  watch
react-before-after-slider
A sexy image comparison slider for React.
Stars: ✭ 63 (+28.57%)
Mutual labels:  comparison

PowerShell-Watch

Build Status Test Coverage

This PowerShell module contains a Watch-Command cmdlet that can be used to repeatedly run a PowerShell command or scriptblock to return output when it has changed.

Watch-Command Get-Service Example

Installation

The module is published in the PSGallery, so if you have PowerShell 5 can be installed by running:

Install-Module Watch -Scope CurrentUser

Usage

You can use the Watch-Command cmdlet by providing it with a ScriptBlock. For example:

Watch-Command -ScriptBlock { Get-Process }

Alternatively ,the cmdlet has been designed so that if it is sent any input via the pipeline other than a ScriptBlock it interprets the pipeline commands that preceded it as the desired ScriptBlock.

This is for convenience, so that you can quickly and easily add | Watch-Command (or its Aliases | watch or | wc) to the end of an existing set of commands to run them repeatedly and output once a change has occurred. For example:

Get-Service | wc

By default the cmdlet will run the specified ScriptBlock every 1 second and then return its output in full once it has changed from the first iteration. You can change the duration between checks via the -Seconds parameter.

You can have the script run continuously (until interrupted via CTRL+C) by adding the -Continuous parameter.

You can have the script return only objects in a collection that have changed or been added by using the -Difference parameter.

If you use -Verbose you will see a timestamp in the console prior to a change being output (particularly useful when using -Continuous and -Difference).

For example:

Get-Service | Watch-Command -Diff -Cont -Verbose

This command will continually list output each time one of the default properties of a service has changed state. Verbose statements above each change will show when they occurred.

By default the cmdlet uses the Compare-Object cmdlet to perform the comparison of the object output by the ScriptBlock with its intitial interation. If the object has a Default Display Property Set (E.g the properties that appear by default in the console) then the comparison is limited to these properties by default. Otherwise it defaults to all available properties of the object.

If you want to specify specific properties to monitor for change, you can do so via the -Property parameter.

For example:

Get-Process | Watch-Command -Diff -Cont -Property id

Watch-Command Get-Process Example

This command will continually list output each time the id property of the output of Get-Process has changed (e.g a new process has started).

By default Watch-Command will use the Default Display Set of properties (if a set exists) as the properties to monitor. If a Default Display Set does not exist then it will use all properties. If you want to force the use of all properties you can specify -Property *.

You can also use Watch-Command to monitor non-PowerShell command output (which will generally be treated as strings). Here's an example of monitoring the output of ipconfig /all for a change to the DNS server addresses:

Watch-Command ipconfig Example

If you want to force Watch-Command to treat the result of the command as an array of strings regardless of the object type returned, you can do so via the -AsString parameter.

Cmdlets

A full list of cmdlets in this module is provided below for reference. Use Get-Help <cmdlet name> with these to learn more about their usage.

Cmdlet Description
Watch-Command Runs a scriptblock or the preceeding pipeline repeatedly until there is change.
Watch Alias for Watch-Command
wc Alias for Watch-Command
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].