I have read the documentation about PowerShell events cmndlets (New-Event, New-ObjectEvent, Register-EngineEvent, etc.), but there no clear information about this kind of task: for example I need to raise the event (to write “It’s reached”), when some code is reach some value:
for($i=0; $i -gt 10; $i++) {
if($i -eq 5) { #HERE THE CODE FOR GENERATE EVENT - ??? }
}
I couldn’t find the similar code example through the Google, so may somebody to provide the code example for generate of this type event ?