简体   繁体   English

检查 Windows 虚拟机是否在使用中

[英]Check if Windows virtual machine is in use

In my organization we are using virtual machines that are running UiPath RPA processes.在我的组织中,我们使用的是运行 UiPath RPA 进程的虚拟机。 In UiPath Orchestrator it is visible in case a process is running via Orchestrator on the virtual machine.在 UiPath Orchestrator 中,如果进程通过 Orchestrator 在虚拟机上运行,​​则它是可见的。

It is also possible to log into the virtual machines manually, via Remote Desktop Connection.也可以通过远程桌面连接手动登录虚拟机。 The issue now is that sometimes when an RPA developer is manually logged in to the virtual machine, another user is starting a process from Orchestrator that is using the same machine.现在的问题是,有时当 RPA 开发人员手动登录到虚拟机时,另一个用户正在使用同一台机器从 Orchestrator 启动一个进程。 This will result in the person manually logged in to the machine being thrown out.这将导致手动登录机器的人被淘汰。

I am trying to come up with a way to detect if a user is already logged in to the machine, and somehow check this before any process is started.我试图想出一种方法来检测用户是否已经登录到机器,并在任何进程启动之前以某种方式检查这一点。

I have experimented and created two batch files that I scheduled via Windows Task Scheduler.我已经通过 Windows Task Scheduler 试验并创建了两个批处理文件。 The batches create a file in a network drive when a user is unlocking the remote machine, and delete the file when the remote machine is locked.当用户解锁远程机器时,批处理在网络驱动器中创建一个文件,并在远程机器锁定时删除该文件。

My issue now is that I would somehow need to check if this file exists before starting any process via Orchestrator.我现在的问题是,在通过 Orchestrator 启动任何进程之前,我需要以某种方式检查此文件是否存在。 So it cannot be done via UiPath, because this would immediately connect to the machine and throw out the other user.所以它不能通过 UiPath 完成,因为这会立即连接到机器并抛出其他用户。

Anyone who has had some similar problem and solved it?有人遇到过类似的问题并解决了吗?

Try a simple approach Check who are already logged in尝试一个简单的方法 检查谁已经登录

Query user /Server:MachineName

This will provide a list of users connected to that Host这将提供连接到该主机的用户列表

Now you / Bot, can send out a message ( Msg ) to the respective user to save his work and logout现在您/机器人可以向相应用户发送一条消息 (Msg) 以保存他的工作并注销

Both ( query & msg ) are available by default on Windows OS Windows OS 默认情况下,两者(查询和消息)都可用

Code your Bot so this action is performed prior you start your automation对您的机器人进行编码,以便在您开始自动化之前执行此操作

Links docs.microsoft.com/en-us/windows-server/administration/windows-commands/query-user docs.microsoft.com/en-us/windows-server/administration/windows-commands/msg链接 docs.microsoft.com/en-us/windows-server/administration/windows-commands/query-user docs.microsoft.com/en-us/windows-server/administration/windows-commands/msg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM