【问题标题】:Tool to run tasks in one of two machines if one is not available如果一台机器不可用,则在两台机器中的一台上运行任务的工具
【发布时间】:2016-04-21 07:54:28
【问题描述】:

我在 Windows Server A 和 Server B 中有两台服务器。它们都是 Task scheduler 中定义的任务。是否有工具或程序允许仅在以下情况下在一台服务器上自动执行任务:

  1. 其中一个服务器不可用。
  2. 其中一台服务器比另一台更早启动。

请帮忙。

【问题讨论】:

    标签: windows scheduled-tasks scheduling


    【解决方案1】:

    我不知道。您需要编写一个脚本来控制它。 IE 服务器 1 检查服务器 2。如果它启动,它会检查它的正常运行时间。如果它的正常运行时间大于服务器 1,它什么也不做。服务器 2 也是如此。

    您可能会遇到同时处理和处理网络信号的情况。您可以通过 wmi Find last boot up time of remote Windows computers using WMI 来查看远程启动时间

    PS C:\>$LastBootUpTime = Get-WmiObject Win32_OperatingSystem -Comp winxpssd |选择 -Exp LastBootUpTime PS C:\> [System.Management.ManagementDateTimeConverter]::ToDateTime($LastBootUpTime)

    Powershell 3 具有 Get-CimInstance,您可以在其中使用 -ComputerName Powertip get the las boot tim with powershell.aspx

    Get-CimInstance 文档可以在here找到

    Get-CimInstance -ClassName win32_operatingsystem |选择 csname, lastbootuptime

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-31
      • 1970-01-01
      • 1970-01-01
      • 2018-01-06
      相关资源
      最近更新 更多