windows 远程锁定计算机

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19735788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 11:02:24  来源:igfitidea点击:

Locking computer remotely

windows

提问by Mayou

Is there any way that one can lock a desktop computer remotely? For example, if one accidently leaves a computer logged on, would there be a way to lock that computer using Remote Connection (VPN)?

有什么方法可以远程锁定台式计算机?例如,如果不小心让计算机保持登录状态,是否有办法使用远程连接 (VPN) 锁定该计算机?

回答by Artur

Use PsExecto invoke:

使用PsExec调用:

rundll32.exe user32.dll, LockWorkStation

on your remote PC.

在您的远程 PC 上。

If you are currently on PC_A and want to lock PC_B, type this on your command line (on PC_A):

如果您当前在 PC_A 上并想锁定 PC_B,请在命令行(在 PC_A 上)键入以下内容:

psexec \\PC_B -u user -p pass "rundll32.exe user32.dll, LockWorkStation"

This way rundll32.exe user32.dll, LockWorkStationwill be invoked on PC_B.

这种方式rundll32.exe user32.dll, LockWorkStation将在 PC_B 上调用。

回答by M.Ganji

You can create a file with an arbitrary name and the suffix bat use this code in bat file

可以创建任意名称和后缀bat的文件,在bat文件中使用这段代码

rundll32.exe user32.dll, LockWorkStation

save and run

保存并运行

回答by Computer

You can use SysInternal tools, mainly the PsShutdowntool. You would get an instance of cmd on the PC and execute the lock command.

您可以使用SysInternal工具,主要是PsShutdown工具。您将在 PC 上获得一个 cmd 实例并执行锁定命令。

Example:

例子:

psshutdown \computername -l