0
Install-SCOMAgent 
-PrimaryManagementServer $MgmtServer 
-DNSHostName $AgentDiscovered
-ActionAccount $Credential

this is the install command to install agents from power shell script

  1. $mgmtServer - is the primary management server.

  2. $AgentsDiscovered - is array of computer names that are discovered and on whom agent is to be installed.

  3. $Credential - contains the credential necessary for installation.

Agents are getting installed. I want the agents installed successfully to be logged into a file.

How to get the return values of Install-SCOMAgent Command to verify if agents are installed successfully or not.

4

2 回答 2

1

您可以在脚本中添加此块代码

$test_installation = Get-SCOMAgent -DNSHostName $AgentDiscovered if ($test_installation -eq $null) {write-host $AgentDiscovered " is not installed on SCOM "$MgmtServer } else { if ($test_installation -eq "success") {write-host $AgentDiscovered " is healthy and installed on SCOM server "$MgmtServer } else {write-host $AgentDiscovered " is not healthy but installed on SCOM server "$MgmtServer} }

于 2015-01-05T08:24:22.370 回答
0

参数 -PassThru 会将对象输出到管道,因此这允许您将它们通过管道传输到其他 cmdlet,或将它们存储到变量中。

我猜这将在 $AgentsDiscovered 中为每台计算机输出一个对象。

于 2014-12-26T12:19:45.837 回答