Jan
15
15
Using WMI Eventsinks
Posted by jbjorkman on January 15, 2011 underDeprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line 82
Powershell
This example will monitor state transitions for a specific service (Wireless Zero Configuration) and speak the result
Register-WmiEvent -Query "select * from __InstanceModificationEvent within 1 where targetinstance isa 'win32_service' and targetinstance.name = 'WZCSVC' and (targetinstance.state='Running' or targetinstance.state='Stopped')" -sourceIdentifier "WZCSVC Status" -action { $evt=$event.SourceEventArgs.newEvent.TargetInstance ; (new-object -com SAPI.SpVoice).Speak($evt.DisplayName + " " + $evt.State + " on computer " + $evt.Systemname,1)}
Add A Comment
You must be logged in to post a comment.