How to hide user from login screen using .NET C#?
-
05-06-2021 - |
Domanda
I need to hide a user account name from "Switch User" screen on Windows. For that I need to add that user's name into Local Computer Policy / Computer configuration / Windows Settings / Security Settings / Local Policies / User Rights Assignment / "Deny log on locally".
I need to do that programmatically.
Do you know how to do that in .NET C#?
Any link or any hint might be helpful...
Thanks.
Soluzione
You need to write information in registry
at first read this Configuring User Rights (you can find the same for other OS)
at second read this Read-write-and-delete-from-registry
EDIT
For Win7 and Vista Win7 and Vista
EDIT2
Go to "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" and create a new key called "SpecialAccounts". Create a subkey of "SpecialAccounts" called "UserList". In the "UserList" key, create a DWORD value with the name of the account you want to hide, and leave the value of that DWORD set to 0. Do this for every account you want to hide.
all of this you can do with second link