Как заблокировать рабочую станцию с помощью объекта групповой политики
Dears, good morning. I developed a Windows Form application in Visual Studio (C#) that aims to lock the employees workstation that is logged into the machine by Windows. This application is running on the employee machine via Group Policy (GPO). Running the program locally, the code below works, but when I run via the GPO, it does not work. Process.Start ("rundll32.exe", "user32.dll, LockWorkStation"); The only thing that worked so far was the commands: * Application.SetSuspendState (PowerState.Hibernate, true, true); // puts the machine into hibernation * Application.SetSuspendState (PowerState.Suspend, true, true); // set the machine to standby I need to lock the workstation. Anyone have any idea how to solve it?
Что я уже пробовал:
I tried the following codes too, but nothing worked: * Process.Start ("rundll32.exe", "user32.dll, LockWorkStation"); * WindowsIdentity.GetCurrent (). User; * WindowsIdentity.GetCurrent (). Groups.Translate (GetUsuario (Name)); * WindowsIdentity.GetCurrent ().Groups.Translate(GetType (NTAccount)).ToString()