如何使用gpo阻止工作站

编程入门 行业动态 更新时间:2024-10-23 23:32:42
本文介绍了如何使用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阻止工作站

本文发布于:2023-11-05 05:00:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559974.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作站   如何使用   gpo

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!