TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Feroz Khan
1.1k
300
92.3k
how can i kill any app through c# from remote machine
Jul 27 2015 4:25 AM
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);
}
Reply
Answers (
4
)
Add Master Page
An exception error