Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top