Install-Agent

Install-Agent

Installs agents.

Syntax

Parameter Set: FromCustomMonitoringObject
Install-Agent [[-ManagementServer] <ManagementServer> ] [-AgentManagedComputer] <CustomMonitoringObject[]> [[-InstallAgentConfiguration] <InstallAgentConfiguration> ] [[-FailoverServers] <ManagementServer[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

Installs agents on managed computers specified by the AgentManagedComputer parameter.

Parameters

-AgentManagedComputer<CustomMonitoringObject[]>

Specifies the computer or computers on which the agent is installed. You can use the start-Discovery cmdlet to retrieve appropriate objects to provide as values for this parameter. To enter multiple values, separate them by commas.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-FailoverServers<ManagementServer[]>

Specifies the fail-over server or servers that will be used by the installed agent. To enter more than one fail-over server, separate them by using commas.

Aliases

none

Required?

false

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-InstallAgentConfiguration<InstallAgentConfiguration>

Specifies agent configuration information. There are no cmdlets supplied to assist you with creating the type of object that this parameter requires as a value. However, you can create and populate such an object by using the new-object cmdlet if you are comfortable working with the .NET framework.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-ManagementServer<ManagementServer>

Specifies the management server for the agent. You can use the get-ManagementServer cmdlet to retrieve an appropriate object to provide as the value for this parameter.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters

Notes

  • For more information, type "Get-Help Install-Agent -detailed". For technical information, type "Get-Help Install-Agent -full".
    When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

Examples

-------------- EXAMPLE 1 --------------

This command installs an agent on a computer named FABRIKAM in the CONTOSO domain. Before the agent can be installed, the computer must be discovered.
The first command uses new-LdapQueryDiscoveryCriteria to create an object that represents the LDAP query (cn=fabrikam) in the CONTOSO domain. Note that backticks are used to continue lines in the command. You do not have to break your command lines in this way; it was done here because the command did not fit on a single line. If you do use the backtick to input commands over multiple lines, press the enter key twice at the end of the command to exit multiple line entry mode.
The second command makes use of the LDAP query information stored in the $ldap_query variable as a result of the first command. The new-WindowsDiscoveryConfiguration cmdlet is used to create a configuration object that can be used for retrieving information about computers (FABRIKAM in this case).
The third command performs the discovery by using the start-Discovery cmdlet and providing it with the configuration object built using the previous two commands. The results of the discover are stored in the $discovery_results variable.
The last command uses the install-Agent cmdlet, supplying the management server and the value of the CustomMonitoringObjects property of the discovery results for FABRIKAM, to install the agent.

C:\PS>$ldap_query = new-ldapquerydiscoverycriteria `
-domain contoso `
-ldapquery "(cn=fabrikam)"
$windows_discovery_cfg = new-windowsdiscoveryconfiguration `
-ldapquery $ldap_query
$discovery_results = start-discovery `
-managementserver (get-managementserver) `
-windowsdiscoveryconfiguration $windows_discovery_cfg
install-agent -managementserver (get-managementserver) `
-agentmanagedcomputer $discovery_results.custommonitoringobjects

-------------- EXAMPLE 2 --------------

This command checks that an agent has been installed on FABRIKAM by using the Get-Agent cmdlet to retrieve all the agents and pipelining the results to the where-Object cmdlet to filter for one on FABRIKAM. This example is included to demonstrate how to verify the results of running Install-Agent.

C:\PS>get-agent | where-object {$_ComputerName -eq "fabrikam"}

Get-ManagementServer

New-DeviceDiscoveryConfiguration

New-LdapQueryDiscoveryCriteria

New-WindowsDiscoveryConfiguration

Start-Discovery

Uninstall-Agent