From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Kill Process with User Credentials

Solved!
Go to solution

I have a need to Kill a process with user credentials.  I have a VI - using .net that performs this when the user has admin credentials.  However I need to be able to kill a process from lower user credentials. There should be a way to change the security settings (programmatically) for that process.  I already create a process with a local admin account but that still does not work.

 

Any help will Find&Close Process.JPGbe greatly appreciated.

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 1 of 3
(2,506 Views)
Solution
Accepted by topic author Spectre_Dave

Hi Spectre Dave,

 

It sounds like you want to impersonate a user account. It's possible to do this in .NET. Here's a Stack Overflow Q&A about it: Impersonation in .NET

 

Since impersonation only applies to the current thread, doing this correctly from G code will require ensuring that your entire VI runs in a single OS thread.

 

Another approach might be to launch a child process as a different user via the "runas" command. This might be easier to get right, and might be closer to what you've already tried.

 

Brad

---
Brad Keryan
NI R&D
Message 2 of 3
(2,499 Views)

Thank you

 

I am NOT a .net programmer but I can figure it out if I know where to look - now I know where to look.

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 3 of 3
(2,485 Views)