如何使用gpo阻止工作站 [英] How to block workstation using gpo

查看:113
本文介绍了如何使用gpo阻止工作站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?





我尝试过:





What I have tried:

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()

推荐答案

你不能做你正在谈论的事情,因为代码是作为LocalSystem而不是用户运行的。锁定工作站是一个用户进程。



您也无法锁定其他用户的工作站。你使用它是为了能够做到这一点,但是自从Win Vista或8以来它没有用,我记不起哪个了。



为什么你到底要做什么?想要这样做吗?
You cannot do what you're talking about because the code is running as LocalSystem, not the user. Locking the workstation is a user process.

You also cannot lock the workstation for another user. You USED to be able to do this, but it hasn't worked since Win Vista or 8, I can't remember which.

Why on earth would you ever want to do this anyway?


这篇关于如何使用gpo阻止工作站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆