Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a little problem.The Device Manager is a list of processes. The process my application is active on my user (FoX0X). How to change the process to belong to the system (Replace "FoX0X" to "SYSTEM")? Besides that if you can not close it in the device manager?
I tried to use the code:
File.SetAttributes("AppName", FileAttributes.System);
But this dont work.
You can not change users a process is running under, you may be able to do impersonation to run a section of code as another user, but you can not modify the process itself to be running as another user.
To make your process run as SYSTEM it must be started under that user.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
In C#, how to check programatically if the current user is in Windows 'Disconnected' state?
Background: On a server, I would like all instances of my program to selv-terminate if the current user is disconnected.
The program is not running in elevated state, i.e. not as administrator.
You will have to override WndProc to hook into the Windows System Messages. This will not be possible if you're in a console app.
see: Detect Active RDP sessions
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
My department wants a script to be run in Windows Powershell on our server that will remove users if their account is locked or hasn't been logged into for a long time. We started with using a C# script to pull from an excel sheet that shows when the last logins were, locked or unlocked, and users' names. How can I go about removing users from our server using a script?
You want to delete it with powershell, not C#, right? If that's the case, The thing you're looking is the Remove-LocalUsercommand.
Remove-LocalUser -Name "NAME OF USER"
EDIT
If you have AD(Active Directory) users, it is almost the same:
Remove-ADUser -Identity NAMEOFUSER
I don't know how to delete any other kinds of users. Sorry!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have created a windows service that checks a new release of an application. And if there is a new release then it will show an alert or message to the user saying that "A new release is available. Do you want to install it?".
My service is ready but I am not able to show this message to the user from Windows Service.
TL;DR: you cannot.
Longer version: a few years ago the use of highly privileged processes (services showing UI) opened up vulnerabilities where user processes could be elevated to gain those higher privileges. Therefore the capability was blocked.
Instead you need a completely separate user process to provide the UI and some form of inter-process communication (like a named pipe with a carefully chosen ACL) to connect to the service. This also allows you to handle the case where no one (via make the connection work across the network) or multiple users are logged in (and none on the console).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am working on folder/file lock program. Lets say my program knows which folders/files were locked, I want my program to launch (wpf window opens and asks for password) when user wants to access locked folder/file ( I want this possibility only on locked folders). Is there a way to do this?
Well. There is several ways. You could write a service that starts a program when locked folders are clicked. You could probably also write a program, that runs in the processline and are hidden normally. But pops up when a locked folder is clicked.
The big question is, why would you want to do that? Sounds like you're trying to write malware.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How can i start an app when user logs on first time on a machine? I need to write an app which assists the user for example configuring other software, printer etc. What i need to ensure is, that this app starts when a user first logs into this machine.
How can I achieve this?
(If it helps, I only need to support Windows 10.)
Make an auxiliar process that starts your app when the computer starts. You can refer this one...
How to run a C# application at Windows startup?
then make a value at your db, for example firstLogin and changed to 0 for this user when your app is running.