【发布时间】:2020-04-16 10:36:24
【问题描述】:
我想检查 msiexec 是处于理想状态还是处于停止状态。如何用powershell检查它?
【问题讨论】:
-
idealstate 你的意思是“跑步”?
标签: powershell shell powershell-2.0 powershell-3.0
我想检查 msiexec 是处于理想状态还是处于停止状态。如何用powershell检查它?
【问题讨论】:
ideal state 你的意思是“跑步”?
标签: powershell shell powershell-2.0 powershell-3.0
你可以这样做:
$chk = Get-Process -Name msiexec -ErrorAction SilentlyContinue
if ($chk -eq $null)
{
# Here goes the statements which will be executed if the process msiexec is not running / stopped
}
else
{
# Here goes the statements which will be executed if the process msiexec is running / ideal state
}
【讨论】: