i am using below code but showing error like - Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
var option = new ConnectionOptions();
option.Username = sys_admin_user_txt.Text;
option.Password = sys_admin_password_txt.Text;
var Kill = exe_name_txt.Text;
//string Kill = exe_name_txt.Text;
ManagementScope scope = new ManagementScope(@"\\"+ ftp +"\\root\\cimv2", option);
// WMI query
var query = new SelectQuery("select * from Win32_process where name = '" + Kill + "'");
using (var searcher = new ManagementObjectSearcher(scope, query))
{
foreach (ManagementObject process in searcher.Get()) // this is the fixed line
{
process.InvokeMethod("Terminate", null);
}
Raja TPosted Jul 27, 2015, 12:58 PM
Please check out bellow URLs
http://forums.iis.net/t/1216194.aspx?Access+is+denied+Exception+from+HRESULT+0x80070005+E_ACCESSDENIED+
https://social.msdn.microsoft.com/Forums/en-US/26accc30-9cfb-4d86-9c27-780f51929ecb/access-is-denied-exception-from-hresult-0x80070005-eaccessdenied?forum=vsreportcontrols
http://forums.asp.net/t/1225290.aspx?Access+is+denied+Exception+from+HRESULT+0x80070005+E_ACCESSDENIED+
Feroz KhanPosted Jul 27, 2015, 7:35 AM
Feroz KhanPosted Jul 27, 2015, 7:25 AM
Manas MohapatraPosted Jul 27, 2015, 4:40 AM