Powershell - Check on Remote Process, if done continue

后端 未结 2 1414
深忆病人
深忆病人 2021-01-12 18:22

As part of a backup operation, I am running the 7zip command to compress a folder into a single .7z file. No problems there as I am using the InVoke-WMIMethod.<

2条回答
  •  情歌与酒
    2021-01-12 18:57

    You should be able to do it with a do... while loop that just sleeps until the process is finished.

     do { 
        "waiting"
        start-sleep 10 
        } while (gwmi -class win32_process -ComputerName $remotehost | Where ProcessName -eq "7za.exe")
    

提交回复
热议问题