Events run into a System.OutOfMemoryException

Issue

When a powerEvents event is triggered the code is not executed and the error message "System.OutOfMemoryException" is shown. This issue can happen with any event

Cause

Currently under investigation. If you experience this issue please contact support@coolorange.com.

Solution

Update your event script to use a Scriptblock in the -Action parameter instead of a function. This example uses the UpdateFileStates event but the issue can happen with any event

# Change from:
Register-VaultEvent -EventName UpdateFileStates_Post -Action 'PostUpdateFileStates'
function PostUpdateFileStates($files) {
# Event code
}

# To
Register-VaultEvent -EventName UpdateFileStates_Post -Action {
param ($files)
# Event code
}