views:

1136

answers:

1

I'm working with a VB Script file written by someone else that uses Windows Management Instrumentation (WMI) calls to check on the status of several Windows Services. This script runs every few minutes on set schedule. I need to upgrade/replace the .exe for those services.

I stop the VB Script, stop the services, and uninstall the services so they no longer appear in the Services panel (services.msc). Unfortunately, WMI (wmiprvse.exe) still has a handle on the service .exe files. I can release the handle by rebooting the system, but I want to avoid that if at all possible so this can be a completely scripted/automated upgrade.

Is there a way I can force WMI to release it's handle on the .exe? Please keep in mind I'm new to working with WMI.

+1  A: 

I'm also looking for a solution to this problem. Would also like to understand why wmiprsve has handles on some of my service executables but not on others.

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

jdigital