powershell 如果AeXNSClient服务处于一致的运行状态,则返回True / False。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 如果AeXNSClient服务处于一致的运行状态,则返回True / False。相关的知识,希望对你有一定的参考价值。
[int]$Seconds = 30
try {
$LastStatus = (Get-Service -Name "AeXNSClient").Status
if ($LastStatus -ne 'Running') {
return $false
} else {
$i = 1
do {
$CurrentStatus = (Get-Service -Name "AeXNSClient").Status
if ($LastStatus -ne $CurrentStatus) {
return $false
}
Write-Host "." -NoNewline
Sleep -Seconds 1
$i++
} while ($i -le $Seconds)
return $true
}
} catch {
return $false
}
以上是关于powershell 如果AeXNSClient服务处于一致的运行状态,则返回True / False。的主要内容,如果未能解决你的问题,请参考以下文章