Powershell 或 CMD 脚本来测试服务器 A 上是否存在卷,如果不存在,请尝试服务器 B

Powershell or CMD script to test if volume exists on Server A and if it doesn't, try Server B

我正在尝试将文件自动复制到 active/passive 集群。我想编写一个脚本,允许我通过某种方式进行 Robocopy 测试以查看服务器 A 上是否存在该卷,如果不存在,则 Robocopy 到服务器 B。现在,我对服务器进行了硬编码,因此如果集群节点发生故障转移,我需要检查每个 Robocopy 脚本并更改服务器名称。

谢谢。

你可以试试Test-Path https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/test-path?view=powershell-6

希望对您有所帮助!