Deleting Users in Windows 10 using Powershell [closed] - c#

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!

Related

c# launch program when user wants to access a folder/file [closed]

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.

Start app when user logs in first time [closed]

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.

Get local path of user with ASP.NET MVC [closed]

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 6 years ago.
Improve this question
Is there any way to execute, get or create any local file by the user specific path? My intension is to create a folder in the user specific local path... something like Y:\newFolder if the user clicks a button in the View ASP.NET MVC. Sorry that I don't have any code sample but I really dont have any idea. Thanks and Greetings!
In a web application there is not actually any user, other than the IIS and the POOL that runs your site.
Now, you application can have users, that you allowed them to logged in, and then where you going to create their files and folders is up to you, and you only.
you can use this
HttpRuntime.AppDomainAppPath
to get your current application path, and from there you can add any folder base on your users.

C# code to make my program login in another one [closed]

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 7 years ago.
Improve this question
I have one little windows form program with 2 buttons , the objective is to open executables , i did it already , yet i want the program to login with my credencials in those executables , accessing to a file where my user id and password is and then writing it in the login box .
Thanks
If the other program doesn't accept login credentials on their command line then consider using SendKeys to send the keystrokes directly. Check out this answer: C# using Sendkey function to send a key to another application

Changing user process on a system process [closed]

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.

Categories