我有以下问题:
当我使用:
Get-Service -Name CcmExec -ErrorAction silentlycontinue
我得到以下列表:
Status Name DisplayName
------ ---- -----------
Running CcmExec SMS Agent Host
或者
Status Name DisplayName
------ ---- -----------
Stopped CcmExec SMS Agent Host
当我使用
$service = Get-Service -Name CcmExec -ErrorAction silentlycontinue -ComputerName $Computername
write-host "$service"
我只看到 ccmexec 而不是“正在运行”或“停止”。