Command Shell Examples
Useful SQL Queries
Discover and install agent - Jonathan Almquist on Operations Manager - Site Home - TechNet Blogs

Discover and install agent

Discover and install agent

  • Comments 1
  • Likes

$query = New-LdapQueryDiscoveryCriteria -domain domain -ldapquery "(cn=target_netbios_name)"

$discoverycfg = New-WindowsDiscoveryConfiguration -ldapquery $query

$discoveryResults = Start-Discovery -managementServer (get-managementServer) -windowsDiscoveryConfiguration $discoverycfg

Install-Agent -managementServer (get-ManagementServer) -agentManagedComputer $discoveryResults.CustomMonitoringObjects

**This example will configure the agent to report to the Management Server you are currently connected to while performing this action.

main menu

I do not moderate this blog anymore. If you have a question regarding this post, send me a message.

Comments
  • i get the following when i try to run this script:

    the script:

    $query = New-LdapQueryDiscoveryCriteria -domain kroger.com -ldapquery "(cn=n060mossdev01)"

    $discoverycfg = New-WindowsDiscoveryConfiguration -ldapquery $query

    $discoveryResults = Start-Discovery -managementServer (get-managementServer) -windowsDiscoveryConfiguration $discoverycfg

    Install-Agent -managementServer (get-ManagementServer) -agentManagedComputer $discoveryResults.CustomMonitoringObjects

    the output:

    Connecting to Operations Manager Management Server 'N060SCE01.kroger.com'.

    PS Monitoring:\N060SCE01.kroger.com

    >$query = New-LdapQueryDiscoveryCriteria -domain kroger.com -ldapquery "(cn=n060mo

    ssdev01)"

    PS Monitoring:\N060SCE01.kroger.com

    >$discoverycfg = New-WindowsDiscoveryConfiguration -ldapquery $query

    PS Monitoring:\N060SCE01.kroger.com

    >$discoveryResults = Start-Discovery -managementServer (get-managementServer) -win

    dowsDiscoveryConfiguration $discoverycfg

    Start-Discovery : Cannot convert 'System.Object[]' to the type 'Microsoft.Enterpr

    iseManagement.Administration.ManagementServer' required by parameter 'ManagementS

    erver'. Specified method is not supported.

    At line:1 char:54

    + $discoveryResults = Start-Discovery -managementServer  <<<< (get-managementServ

    er) -windowsDiscoveryConfiguration $discoverycfg

    PS Monitoring:\N060SCE01.kroger.com

    >Install-Agent -managementServer (get-ManagementServer) -agentManagedComputer $dis

    coveryResults.CustomMonitoringObjects

    Install-Agent : Cannot convert 'System.Object[]' to the type 'Microsoft.Enterpris

    eManagement.Administration.ManagementServer' required by parameter 'ManagementSer

    ver'. Specified method is not supported.

    At line:1 char:32

    + Install-Agent -managementServer  <<<< (get-ManagementServer) -agentManagedCompu

    ter $discoveryResults.CustomMonitoringObjects

    PS Monitoring:\N060SCE01.kroger.com

    >