Want a Windows WMI script (wmiprvse.exe) to free a file descriptor

I am working with a VB Script file written by someone else that uses Windows Management Instrumentation (WMI) calls to check the status of several Windows services. This Script runs every few minutes according to a set schedule. I need to update / replace .exe for these services.

I stop VB Script, stop the services, and delete the services so that they no longer appear in the Services panel (services.msc). Unfortunately, WMI (wmiprvse.exe) still has a handle in the service .exe files. I can free the descriptor by rebooting the system, but I want to avoid this, if at all possible, so this could be a fully written / automatic update.

Is there a way to get WMI to release the handle on .exe? Please keep in mind that I am new to WMI.

+2
scripting wmi windows-services
Nov 19 '08 at 15:41
source share
2 answers

I am also looking for a solution to this problem. I would also like to understand why wmiprsve has descriptors for some of my service executables, but not for others.

The workaround I'm using is to kill the wmiprvse process. You can use the SysInternals command line tools (pslist, pskill) to automate the process ID and kill.

+1
Nov 19 '08 at 15:54
source share

You can simply restart the WMI service (winmgmt) to make it release your files. If your service is not registered when starting WMI, it will not block files.

Stop the service, delete the service, restart WMI, replace the files, start the service.

0
Jul 11 '14 at 8:37
source share



All Articles