有没有办法可以远程锁定桌面计算机?例如,如果一个人意外地让计算机登录,是否有办法使用远程连接(VPN)锁定该计算机?
答案 0 :(得分:9)
使用PsExec
调用:
rundll32.exe user32.dll,LockWorkStation
在遥控器上。
因此,如果您当前在PC_A上并且想要锁定PC_B,请在命令行上键入它(在PC_A上):
psexec \\ PC_B -u user -p pass“rundll32.exe user32.dll,LockWorkStation”
这样就可以在PC_B上调用 rundll32.exe user32.dll,LockWorkStation
答案 1 :(得分:4)
您可以使用任意名称创建文件,后缀bat在bat文件中使用此代码
rundll32.exe user32.dll, LockWorkStation
保存并运行
答案 2 :(得分:0)
您可以使用sysinternal工具,主要是PsShutdown工具。您将在PC上获得cmd的实例并执行锁定命令
http://technet.microsoft.com/en-gb/sysinternals/bb897541
示例psshutdown \ computername -l </ p>
答案 3 :(得分:-1)
Option Explicit
Dim objWMIService, objProcess
Dim strShell, objProgram, strComputer, strExe, strInput
strExe = "rundll32.exe user32.dll,LockWorkStation"
' Input Box to get name of machine to run the process
Do
strComputer = (InputBox(" ComputerName to Run Script",_
"Computer Name"))
If strComputer <> "" Then
strInput = True
End if
Loop until strInput = True
' Connect to WMI
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")
' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
"Create").InParameters.SpawnInstance_
objProgram.CommandLine = strExe
'Execute the program now at the command line.
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
'WScript.echo "Created: " & strExe & " on " & strComputer
WSCript.Quit
' End of Example of a Process VBScript