WMI, Win32_Process or Process class question with IE
-
just wondering if there's any way I can get the currectly active URL of IE using the process class or WMI?... Basically I want to be able to remotely shut down IE if a certain webpage is hit. I can get PID and name easily with the process class to put them in a datagrid, and then kill the process with WMI, just wondering how much more is possible.
-
just wondering if there's any way I can get the currectly active URL of IE using the process class or WMI?... Basically I want to be able to remotely shut down IE if a certain webpage is hit. I can get PID and name easily with the process class to put them in a datagrid, and then kill the process with WMI, just wondering how much more is possible.
No, you can't get it using WMI. You have to do this using the Shell.Application object. You can then get the open browser windows from the Windows property, then iterate through those to get the LocationName and LocationURL's. You'll need code running on each of the client machines you're monitoring because I don't think you can create the Shell.Application object on a remote server. The other problem is that this will only work for IE browser windows. It will NOT work if the user is using any other web browser.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
No, you can't get it using WMI. You have to do this using the Shell.Application object. You can then get the open browser windows from the Windows property, then iterate through those to get the LocationName and LocationURL's. You'll need code running on each of the client machines you're monitoring because I don't think you can create the Shell.Application object on a remote server. The other problem is that this will only work for IE browser windows. It will NOT work if the user is using any other web browser.
Dave Kreskowiak Microsoft MVP - Visual Basic
Rats... was hoping to get away without having anything running on every machine... idea was to just have an old system sitting in my server room keeping an eye on things when required... I suppose it would be perfectly feasable for me to just have the client side bit of code as a very small app that can be run as a process (it won't have a GUI) when required on each client machine. programs already doing its main job which is killing MSN on certain computers when people take advantage of my relaxed nature so I don't have to block it for everyone. I could set up the firewall to block certain sites like myspace.com but again, I don't want to kill it for everyone, only the people who are abusing it, and as I'm using IPCop its a bit of a pain to turn it on and off.