Contact Info

Crumbtrail » Administration » Powershell » Powershell 2.0 » New-Event

New-Event - Powershell 2.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Short description
Creates a new event.

New-Event [-SourceIdentifier] <string> [[-Sender] <psobject>] [[-EventArguments] <PSObject[]>] [[-MessageData] <pso
bject>] [<CommonParameters>]

The New-Event cmdlet creates a new custom event. 

You can use custom events to notify users about state changes in your program and any change that your program can 
detect, including hardware or system conditions, application status, disk status, network status, or the completion
 of a background job.

Custom events are automatically added to the event queue in your session whenever they are raised; you do not need 
to subscribe to them. However, if you want to forward an event to the local session or specify an action to respond
 to the event, use the Register-EngineEvent cmdlet to subscribe to the custom event. 

When you subscribe to a custom event, the event subscriber is added to your session. If you cancel the event subscr
iption by using the Unregister-Event cmdlet, the event subscriber and custom event are deleted from the session. If
 you do not subscribe to the custom event, to delete the event, you must change the program conditions or close the
 Windows PowerShell session.