共用方式為


Install-SCOMAgent

Deploys Operations Manager agents.

Syntax

Install-SCOMAgent
       -ActionAccount <PSCredential>
       [-AgentActionAccount <PSCredential>]
       -DNSHostName <String[]>
       -PrimaryManagementServer <ManagementServer>
       [-NoAPM]
       [-PassThru]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

The Install-SCOMAgent cmdlet deploys one or more System Center 2019 - Operations Manager and later product version agents by using client push installation. Note: [-NoAPM] parameter is introduced with System Center Operations Manager 1807 (this parameter is not valid with System Center 2019 Operations Manager).

Examples

Example 1: Install an agent on a server

PS C:\>$PrimaryMgmtServer = Get-SCOMManagementServer -ComputerName "MgmtServer01.Contoso.com"
PS C:\> Install-SCOMAgent -DNSHostName "server01.contoso.com" -PrimaryManagementServer $PrimaryMgmtServer

This example installs an agent on a server and sets the primary management server for the agent.

The first command gets the management server object named MgmtServer01.Contoso.com and stores the object in the $PrimaryMgmtServer variable.

The second command installs an agent on Server01.Contoso.com, and sets its primary management server to the management server stored in $PrimaryMgmtServer.

Example 2: Install an agent on a server by using the action account credentials

PS C:\>$InstallAccount = Get-Credential
PS C:\> $PrimaryMgmtServer = Get-SCOMManagementServer -ComputerName "MgmtServer01.Contoso.com"
PS C:\> Install-SCOMAgent -DNSHostName "Server01.Contoso.com" -PrimaryManagementServer $PrimaryMgmtServer -ActionAccount $InstallAccount

This example prompts the user to enter credentials and then uses the credentials to install an agent.

The first command prompts the user for credentials and store credentials in the $InstallAccount variable.

The second command gets the management server object named MgmtServer01.Contoso.com and stores the object in the $PrimaryMgmtServer variable.

The third command installs an agent on Server01.Contoso.com by using the credentials stored in $InstallAccount, and sets the primary management server for the agent to the management server stored in $PrimaryMgmtServer.

Example 3: Install an agent on servers and set the agent action account

PS C:\>$Agents = "DC1.contoso.com","DC2.contoso.com","DC3.contoso.com"
PS C:\> $InstallAccount = Get-Credential
PS C:\> $AgentActionAccount = Get-Credential Contoso\ActionAccount
PS C:\> $PrimaryMgmtServer = Get-SCOMManagementserver -ComputerName MgmtServer01.contoso.com
PS C:\> $Install-SCOMAgent -DNSHostName $Agents -PrimaryManagementServer $PrimaryMgmtServer -ActionAccount $InstallAccount -AgentActionAccount $AgentActionAccount -Confirm

This example installs agents on three computers and sets the agent action account for the agents.

The first command stores the name of three computers in the $Agents variable.

The second command prompts the user for credentials and stores the credentials in the $InstallAccount variable.

The third command prompts the user for a password for a user account named ActionAccount in the Contoso domain, and stores the credentials in the $AgentActionAccount variable.

The fourth command gets the management server object named MgmtServer01.Contoso.com and stores the object in the $PrimaryMgmtServer variable.

The fifth command installs an agent on the three computers stored in the $Agents variable by using the credentials stored in $InstallAccount. The command sets the primary management server for the agent to the management server stored in $PrimaryMgmtServer, and sets the agent action account to the ActionAccount user stored in $AgentActionAccount.

Parameters

-ActionAccount

Specifies a PSCredential object. This parameter specifies the credentials that Operations Manager uses to run the deployment task. This is a mandatory parameter. If you specify a null value, Operations Manager uses the default action account of the management server for the agent.

This parameter does not specify the action account that the agent uses after you install it on the computer. By default, the action account that the agent uses is set to Local System. You can use the AgentActionAccount parameter to change the action account that the agent uses.

To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AgentActionAccount

Specifies a PSCredential object. This parameter specifies the action account that the agent uses after it is installed on the computer. By default, the action account that the agent uses is set to Local System. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential. You can use the Get-SCOMRunAsProfile cmdlet to get a Run As accounts that you can use for the action account.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DNSHostName

Specifies the name of a Domain Name System (DNS) host.

Type:String[]
Aliases:Name
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-NoAPM

This is an optional parameter introduced with System Center Operations Manager 1807 (this parameter is not valid with System Center 2019 Operations Manager), which allows you choose the installation of APM component in the agent. Use this parameter to skip the installation of APM component in the agent.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PassThru

Indicates that the cmdlet creates or modifies an object that a command can use in the pipeline. By default, this cmdlet does not generate any output.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PrimaryManagementServer

Specifies a ManagementServer object. This parameter specifies the primary management server for the agent. To obtain a ManagementServer object, use the Get-SCOMManagementServer cmdlet.

Type:ManagementServer
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False