Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Guest
2021-04-16T10:43:01Z
Using Visualcron version 9.1.0
Using Powershell Framework Version: v4.0.30319

We have Powershell script connecting to the VC Server/ Client via APIs and monitoring for events.

PS script:
.....
$Server = $Client.Connect($conn, $true);
Register-ObjectEvent -InputObject $Server.Permissions -EventName "UserRemoved" -action {
#do some actions when UserRemoved event fired
}
.....

I have found that removing a user, causes the powershell script to crash with error 0xc0000005 reported. Has anyone else experienced this issue?
Sponsor
Forum information
bweston
2021-04-20T14:02:08Z
Not my area of expertise, as I have thus far only used Powershell and the API for manipulations rather than monitors, but... Have you already tested having the action be nothing but, say, logging a line somewhere that you've confirmed works for some other event, to verify whether the crash is triggered by the event or by one of the actions you were attempting in response?
Support
2021-04-22T11:39:33Z
Originally Posted by: obristo 

Using Visualcron version 9.1.0
Using Powershell Framework Version: v4.0.30319

We have Powershell script connecting to the VC Server/ Client via APIs and monitoring for events.

PS script:
.....
$Server = $Client.Connect($conn, $true);
Register-ObjectEvent -InputObject $Server.Permissions -EventName "UserRemoved" -action {
#do some actions when UserRemoved event fired
}
.....

I have found that removing a user, causes the powershell script to crash with error 0xc0000005 reported. Has anyone else experienced this issue?



So it's just the powershell script crashing? What happens if you run that code in a visualcron powershell task?

Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Guest
2021-04-22T13:03:40Z
Originally Posted by: bweston 

Not my area of expertise, as I have thus far only used Powershell and the API for manipulations rather than monitors, but... Have you already tested having the action be nothing but, say, logging a line somewhere that you've confirmed works for some other event, to verify whether the crash is triggered by the event or by one of the actions you were attempting in response?





I did test using a simple out-file command to write a log to ensure it wasn't the "on event action" code I wrote but the PS crashes out before it makes it this far.
Guest
2021-04-22T13:11:07Z
So it's just the powershell script crashing? What happens if you run that code in a visualcron powershell task?



I didn't think about setting up an event listener in a powershell task as the registered event and the action to perform only exists whilst the PS session is active. I do not believe a powershell task would keep an active session once the task has finished.

Having said this out loud I am not sure powershell is the way to go for this particular problem.
Support
2021-05-13T09:52:13Z
Originally Posted by: obristo 

So it's just the powershell script crashing? What happens if you run that code in a visualcron powershell task?



I didn't think about setting up an event listener in a powershell task as the registered event and the action to perform only exists whilst the PS session is active. I do not believe a powershell task would keep an active session once the task has finished.

Having said this out loud I am not sure powershell is the way to go for this particular problem.



Hi,

Sincere apologies for the long delay of reply, just wanted to check up on you and see if you still need help with this?
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top