Launch scripts when certain events happen in Windows.
System events subscribe to WMI events within Windows and run scripts. You can then take action by running scripts.
To define a system event, you can use the New-PSUSystemEvent
cmdlet within the systemEvents.ps1
file. The following example triggers the systemEvent.ps1
script when a pwsh.exe
process is started.
When a script is executed, you will receive a $TargetInstance
parameter. This contains the WMI object that caused the event to trigger.