Asynchronous WMI Event Handling in .NET
i trying run processes remotely using wmi , wait process finish. event watcher semi-synchronous using waitfornextevent has timeout in case happens program. works well. tried modifying asynchronous event handling access denied error when starting event watcher. not big deal because stick semi-synchronous method, there 1 exception.
if, reason, during execution of program machine restarts, freezes, or looses network connection, waitfornextevent not throw timeout exception, blocks thread indefinitely(i left there 10 minutes no answer , timeout 30 seconds). question is: know if event watcher can set in specific way in order timeout regardless of connection, or setup client side in order have access asynchronous permissions. normally, first 1 be preferred, second 1 option.
managementeventwatcher w = new managementeventwatcher(managementscope, new wqleventquery("select * win32_processstoptrace processid=" + processid)); w.options.timeout = new timespan(0, 0, 0, 30); var ev = w.waitfornextevent(); //do stuff
hi cristian,
please ask in script forum query involves scripting.
http://social.technet.microsoft.com/forums/en/itcg/threads
thanks
zhang
Windows Server > Management
Comments
Post a Comment