Start a new topic

powerEvents not firing

Working:

Register-VaultEvent -EventName AddFile_Restrictions -Action 'AddFileRestriction'


function AddFileRestriction($file){

 [System.Windows.MessageBox]::Show('file restriction')

 Show-Inspector

}


NOT WORKING:

Register-VaultEvent -EventName AddFile_Pre - Action 'PreAddFile'

Register-VaultEvent -EventName AddFile_Post - Action 'PostAddFile'


function PostAddFile($file){

 [System.Windows.MessageBox]::Show('Post - Add File')

 Show-Inspector

}

function PreAddFile($file){

 [System.Windows.MessageBox]::Show('Pre - Add File')

 Show-Inspector

}


My only guess is that I'm doing something wrong?

Thanks,

1 Comment

Hello Tim,

your code works fine for me but you mustn't have spaces between the minus and the parameter name as space is interpreted as space seperates the parameters


#So i you change 

Register-VaultEvent -EventName AddFile_Pre - Action 'PreAddFile'

Register-VaultEvent -EventName AddFile_Post - Action 'PostAddFile'


#to

Register-VaultEvent -EventName AddFile_Pre -Action 'PreAddFile'

Register-VaultEvent -EventName AddFile_Post -Action 'PostAddFile'


it should work


Best regards,

Thomas

Login or Signup to post a comment