确定远程 Windows 计算机上的登录用户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/159837/
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-15 11:22:05  来源:igfitidea点击:

Determine logged on user on a remote Windows machine

windowsadministration

提问by David Hayes

Is there a way to determine who is logged on to a particular (remote) machine given the IP address (or the workstation name) of the machine?

有没有办法根据机器的 IP 地址(或工作站名称)确定谁登录到特定(远程)机器?

  • The machines in question are on an Active Directory Domain
  • The user running the script probably won't have any special rights on either their local or the remote machine
  • Operating system is Windows XP
  • 有问题的机器位于 Active Directory 域中
  • 运行脚本的用户可能在他们的本地或远程机器上没有任何特殊权限
  • 操作系统为 Windows XP

Any programming language is fine but ideally

任何编程语言都可以,但理想情况下

  • VBScript (yeah I know)
  • C#
  • Java
  • DOS Batch file
  • VBScript(是的,我知道)
  • C#
  • 爪哇
  • DOS批处理文件

回答by benPearce

PSloggedon from SysInternals will provide this from a batch file, however the user would require admin access on the remote machine. I doubt you can get this information without Administrator access.

SysInternals 的 PSloggedon 将通过批处理文件提供此信息,但是用户需要远程计算机上的管理员访问权限。我怀疑您是否可以在没有管理员访问权限的情况下获取此信息。

回答by EBGreen

Difficult to do depending on the permissioning on the machine. One way is to query WMI on the remote machine and check the owner of the explorer.exe process.

取决于机器上的许可,很难做到。一种方法是在远程机器上查询 WMI 并检查 explorer.exe 进程的所有者。

回答by EBGreen

You don't need admin access. Just use net apis. ask on news://194.177.96.26/comp.os.ms-windows.programmer.win32 where it's a FAQ

您不需要管理员访问权限。只需使用网络api。在 news://194.177.96.26/comp.os.ms-windows.programmer.win32 上询问,这是一个常见问题解答