$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 get the following when i try to run this script:
the script:
$query = New-LdapQueryDiscoveryCriteria -domain kroger.com -ldapquery "(cn=n060mossdev01)"
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)"
>$discoverycfg = New-WindowsDiscoveryConfiguration -ldapquery $query
>$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
>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
>